aPiecek | 6d41a52 | 2023-03-27 14:20:38 +0200 | [diff] [blame] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}] |
| 2 | |
| 3 | set mdir $::env(YANG_MODULES_DIR) |
| 4 | |
aPiecek | 080c2bf | 2023-03-28 14:27:52 +0200 | [diff] [blame] | 5 | test add_basic {} { |
| 6 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 7 | ly_cmd "add $mdir/modleafref.yang" |
| 8 | ly_cmd "list" "I modleafref\r.*I modleaf" |
| 9 | }} |
| 10 | |
aPiecek | 6d41a52 | 2023-03-27 14:20:38 +0200 | [diff] [blame] | 11 | test add_disable_searchdir_once {add --disable-searchdir} { |
| 12 | -setup $ly_setup -cleanup $ly_cleanup -constraints {!ctest} -body { |
| 13 | ly_cmd "add $mdir/modimp-cwd.yang" |
| 14 | ly_cmd "clear" |
| 15 | ly_cmd_err "add -D $mdir/modimp-cwd.yang" "not found in local searchdirs" |
| 16 | }} |
| 17 | |
| 18 | test add_disable_searchdir_twice {add -D -D} { |
| 19 | -setup $ly_setup -cleanup $ly_cleanup -constraints {!ctest} -body { |
| 20 | ly_cmd "add $mdir/ietf-ip.yang" |
| 21 | ly_cmd "clear" |
| 22 | ly_cmd_err "add -D -D $mdir/ietf-ip.yang" "Loading \"ietf-interfaces\" module failed." |
| 23 | }} |
| 24 | |
aPiecek | a96d443 | 2023-03-27 15:49:06 +0200 | [diff] [blame] | 25 | test add_with_feature {Add module with feature} { |
| 26 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 27 | ly_cmd "add --feature modfeature:ftr2 $mdir/modfeature.yang" |
| 28 | ly_cmd "feature -a" "modfeature:\r\n\tftr1 \\(off\\)\r\n\tftr2 \\(on\\)" |
| 29 | }} |
| 30 | |
aPiecek | 080c2bf | 2023-03-28 14:27:52 +0200 | [diff] [blame] | 31 | test add_make_implemented_once {add --make-implemented} { |
| 32 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 33 | ly_ignore "add $mdir/modmust.yang" |
| 34 | ly_cmd "list" "I modmust\r.*i modleaf" |
| 35 | ly_cmd "clear" |
| 36 | ly_ignore "add -i $mdir/modmust.yang" |
| 37 | ly_cmd "list" "I modmust\r.*I modleaf" |
| 38 | }} |
| 39 | |
| 40 | test add_make_implemented_twice {add -i -i} { |
| 41 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 42 | ly_cmd "add $mdir/modimp-type.yang" |
| 43 | ly_cmd "list" "I modimp-type\r.*i modtypedef" |
| 44 | ly_cmd "clear" |
| 45 | ly_cmd "add -i -i $mdir/modimp-type.yang" |
| 46 | ly_cmd "list" "I modimp-type\r.*I modtypedef" |
| 47 | }} |
| 48 | |
aPiecek | 88030e5 | 2023-06-02 11:03:57 +0200 | [diff] [blame] | 49 | test add_extended_leafref_enabled {Valid module with --extended-leafref option} { |
| 50 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 51 | ly_cmd "add -X $mdir/modextleafref.yang" |
| 52 | }} |
| 53 | |
| 54 | test add_extended_leafref_disabled {Expected error if --extended-leafref is not set} { |
| 55 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 56 | ly_cmd_err "add $mdir/modextleafref.yang" "Unexpected XPath token \"FunctionName\"" |
| 57 | }} |
| 58 | |
aPiecek | 6d41a52 | 2023-03-27 14:20:38 +0200 | [diff] [blame] | 59 | cleanupTests |