yanglint TEST for --extended-leafref option
diff --git a/tools/lint/tests/modules/modextleafref.yang b/tools/lint/tests/modules/modextleafref.yang
new file mode 100644
index 0000000..d45ec71
--- /dev/null
+++ b/tools/lint/tests/modules/modextleafref.yang
@@ -0,0 +1,24 @@
+module modextleafref {
+  namespace "urn:yanglint:modextleafref";
+  prefix mel;
+
+  list ls {
+    key k;
+    leaf k {
+      type string;
+    }
+    leaf lf {
+      type uint8;
+    }
+  }
+  leaf lfr {
+    type leafref {
+      path "../ls/k";
+    }
+  }
+  leaf lfrderef {
+    type leafref {
+      path "deref(../lfr)/../lf";
+    }
+  }
+}
diff --git a/tools/lint/tests/non-interactive/extended_leafref.test b/tools/lint/tests/non-interactive/extended_leafref.test
new file mode 100644
index 0000000..5e1a90e
--- /dev/null
+++ b/tools/lint/tests/non-interactive/extended_leafref.test
@@ -0,0 +1,13 @@
+source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}]
+
+set mdir $::env(YANG_MODULES_DIR)
+
+test extended_leafref_enabled {Valid module with --extended-leafref option} {
+    ly_cmd "-X $mdir/modextleafref.yang"
+} {}
+
+test extended_leafref_disabled {Expected error if --extended-leafref is not set} {
+    ly_cmd_err "$mdir/modextleafref.yang" "Unexpected XPath token \"FunctionName\""
+} {}
+
+cleanupTests