blob: cac08104f69be130fdc2f33f3c6e4b70a14aa940 [file] [log] [blame]
aPiecek266ca762023-03-22 15:04:59 +01001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
2
aPiecek080c2bf2023-03-28 14:27:52 +02003set mdir $::env(YANG_MODULES_DIR)
aPiecek9b2fba62023-05-19 11:31:48 +02004set ddir $::env(TESTS_DIR)/data
aPiecek080c2bf2023-03-28 14:27:52 +02005
aPiecek07bc9632023-06-01 12:14:48 +02006test clear_searchpath {searchpath is also deleted} {
7-setup $ly_setup -cleanup $ly_cleanup -body {
8 ly_cmd "searchpath ./"
9 ly_cmd "clear"
10 ly_cmd "searchpath" "List of the searchpaths:" -ex
11}}
12
aPiecek080c2bf2023-03-28 14:27:52 +020013test clear_make_implemented_once {clear --make-implemented} {
14-setup $ly_setup -cleanup $ly_cleanup -body {
15 ly_cmd "clear -i"
16 ly_cmd "add $mdir/modmust.yang"
17 ly_cmd "list" "I modmust\r.*I modleaf"
18}}
19
20test clear_make_implemented_twice {clear -i -i} {
21-setup $ly_setup -cleanup $ly_cleanup -body {
22 ly_cmd "clear -i -i"
23 ly_cmd "add $mdir/modmust.yang"
24 ly_cmd "list" "I modmust\r.*I modleaf"
25}}
26
aPiecek266ca762023-03-22 15:04:59 +010027test clear_ietf_yang_library {clear --yang-library} {
28-setup $ly_setup -cleanup $ly_cleanup -body {
29 # add models
30 ly_cmd "clear -y"
31 ly_cmd "list" "I ietf-yang-library"
32}}
33
aPiecek9b2fba62023-05-19 11:31:48 +020034test clear_ylf_list {apply --yang-library-file and check result by --list} {
35-setup $ly_setup -cleanup $ly_cleanup -body {
36 ly_cmd "clear -Y $ddir/modimp_type_ctx.xml"
37 ly_cmd "list" "I modimp-type.*i modtypedef"
38}}
39
40test clear_ylf_make_implemented {apply --yang-library-file and --make-implemented} {
41-setup $ly_setup -cleanup $ly_cleanup -body {
42 ly_cmd "clear -Y $ddir/modimp_type_ctx.xml -i -i"
43 ly_cmd "list" "I modimp-type.*I modtypedef"
44}}
45
46test clear_ylf_augment_ctx {Setup context by yang-library-file and augment module} {
47-setup $ly_setup -cleanup $ly_cleanup -body {
48 ly_cmd "clear -Y $ddir/modconfig_ctx.xml"
49 ly_cmd "add $mdir/modconfig-augment.yang"
50 ly_cmd "print -f tree modconfig" "mca:alf"
51}}
52
aPiecek266ca762023-03-22 15:04:59 +010053cleanupTests