summaryrefslogtreecommitdiffstats
path: root/tests/yanglint/interactive/data_default.test
blob: 1953acc2447b7eeaeba6ce543de9a9f9c8d9e89c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]

set mods "ietf-netconf-with-defaults moddefault"
set data "$::env(TESTS_DIR)/data/moddefault.xml"

test data_default_not_set {Print data without --default parameter} {
-setup $ly_setup -cleanup $ly_cleanup -body {
    ly_cmd "load $mods"
    ly_cmd "data -f xml $data" "</lf>.*</di>\r\n</mdc>"
    ly_cmd "data -f json $data" "lf\".*di\"\[^\"]*"
}}

test data_default_all {data --default all} {
-setup $ly_setup -cleanup $ly_cleanup -body {
    ly_cmd "load $mods"
    ly_cmd "data -d all -f xml $data" "</lf>.*</di>.*</ds>\r\n</mdc>"
    ly_cmd "data -d all -f json $data" "lf\".*di\".*ds\"\[^\"]*"
}}

test data_default_all_tagged {data --default all-tagged} {
-setup $ly_setup -cleanup $ly_cleanup -body {
    ly_cmd "load $mods"
    ly_cmd "data -d all-tagged -f xml $data" "</lf>.*<di.*default.*</di>.*<ds.*default.*</ds>\r\n</mdc>"
    ly_cmd "data -d all-tagged -f json $data" "lf\".*di\".*ds\".*@ds\".*default\"\[^\"]*"
}}

test data_default_trim {data --default trim} {
-setup $ly_setup -cleanup $ly_cleanup -body {
    ly_cmd "load $mods"
    ly_cmd "data -d trim -f xml $data" "</lf>\r\n</mdc>"
    ly_cmd "data -d trim -f json $data" "lf\"\[^\"]*"
}}

test data_default_implicit_tagged {data --default implicit-tagged} {
-setup $ly_setup -cleanup $ly_cleanup -body {
    ly_cmd "load $mods"
    ly_cmd "data -d implicit-tagged -f xml $data" "</lf>.*<di>5</di>.*<ds.*default.*</ds>\r\n</mdc>"
    ly_cmd "data -d implicit-tagged -f json $data" "lf\".*di\"\[^@]*ds\".*default\"\[^\"]*"
}}

cleanupTests