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
