yanglint TEST printing data in xml and json format
diff --git a/tools/lint/tests/interactive/data_format.test b/tools/lint/tests/interactive/data_format.test
new file mode 100644
index 0000000..56a93f6
--- /dev/null
+++ b/tools/lint/tests/interactive/data_format.test
@@ -0,0 +1,17 @@
+source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
+
+set ddir "$::env(TESTS_DIR)/data"
+
+test data_format_xml {Print data in xml format} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+    ly_cmd "load modleaf"
+    ly_cmd "data -f xml $ddir/modleaf.xml" "<lfl xmlns=\"urn:yanglint:modleaf\">7</lfl>"
+}}
+
+test data_format_json {Print data in json format} {
+-setup $ly_setup -cleanup $ly_cleanup -body {
+    ly_cmd "load modleaf"
+    ly_cmd "data -f json $ddir/modleaf.xml" "{\r\n  \"modleaf:lfl\": 7\r\n}"
+}}
+
+cleanupTests
diff --git a/tools/lint/tests/non-interactive/format.test b/tools/lint/tests/non-interactive/format.test
index 5c23ddb..601acfc 100644
--- a/tools/lint/tests/non-interactive/format.test
+++ b/tools/lint/tests/non-interactive/format.test
@@ -1,6 +1,7 @@
 source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}]
 
 set mdir $::env(YANG_MODULES_DIR)
+set ddir $::env(TESTS_DIR)/data
 set ipv6_path "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address"
 
 test format_yang {} {
@@ -27,6 +28,14 @@
     ly_cmd "-f tree $mdir/modleaf.yang" "\\+--rw lfl"
 } {}
 
+test format_data_xml {Print data in xml format} {
+    ly_cmd "-f xml $mdir/modleaf.yang $ddir/modleaf.xml" "<lfl xmlns=\"urn:yanglint:modleaf\">7</lfl>"
+} {}
+
+test format_data_json {Print data in json format} {
+    ly_cmd "-f json $mdir/modleaf.yang $ddir/modleaf.xml" "{\n  \"modleaf:lfl\": 7\n}"
+} {}
+
 test format_tree_submodule {Print submodule in tree format} {
     ly_cmd "-s modsub -f tree $mdir/modinclude.yang" "submodule: modsub"
 } {}