File: data_not_strict.test

package info (click to toggle)
libyang 5.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 11,212 kB
  • sloc: ansic: 131,170; xml: 671; sh: 448; tcl: 325; makefile: 19
file content (25 lines) | stat: -rw-r--r-- 982 bytes parent folder | download | duplicates (5)
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
source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]

set ddir $::env(TESTS_DIR)/data

test data_no_strict_basic {} {
-setup $ly_setup -cleanup $ly_cleanup -body {
    ly_cmd "load modleaf"
    ly_cmd_err "data $ddir/modmandatory.xml" "No module with namespace \"urn:yanglint:modmandatory\" in the context."
    ly_cmd "data -n $ddir/modmandatory.xml"
}}

test data_no_strict_invalid_data {validation with --no-strict but data are invalid} {
-setup $ly_setup -cleanup $ly_cleanup -body {
    set errmsg "Mandatory node \"lft\" instance does not exist."
    ly_cmd "load modmandatory"
    ly_cmd_err "data -n $ddir/modmandatory_invalid.xml" $errmsg
}}

test data_no_strict_ignore_invalid_data {--no-strict ignore invalid data if no schema is provided} {
-setup $ly_setup -cleanup $ly_cleanup -body {
    ly_cmd "load modleaf"
    ly_cmd "data -f xml -n $ddir/modmandatory_invalid.xml $ddir/modleaf.xml" "modleaf.*</lfl>$"
}}

cleanupTests