summaryrefslogtreecommitdiff
path: root/tests/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-15 00:40:08 +0800
committerruki <[email protected]>2025-11-15 00:40:08 +0800
commitdc6a23d0752243d950b81628124fcaa9b907dabe (patch)
tree04d65b63f6062c0e15636da283edfd04f65df6be /tests/modules
parente8aa6bd86dcfc67fb2fd5d9bb4319a956097f9c1 (diff)
add new apis
Diffstat (limited to 'tests/modules')
-rw-r--r--tests/modules/xml/test.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/modules/xml/test.lua b/tests/modules/xml/test.lua
index 841a1c797..60d50d62a 100644
--- a/tests/modules/xml/test.lua
+++ b/tests/modules/xml/test.lua
@@ -101,3 +101,26 @@ function test_plist_sample(t)
t:are_equal(last_flag.name, "true")
end
+function test_scan_stop(t)
+ local plist = [[
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+ </dict>
+</plist>]]
+ local found
+ xml.scan(plist, function(node)
+ if node.name == "key" and xml.text_of(node) == "NSPrincipalClass" then
+ found = node
+ return false
+ end
+ end)
+ t:are_equal(found ~= nil, true)
+ t:are_equal(xml.text_of(found), "NSPrincipalClass")
+end
+