diff options
| author | ruki <[email protected]> | 2025-11-15 00:40:08 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-15 00:40:08 +0800 |
| commit | dc6a23d0752243d950b81628124fcaa9b907dabe (patch) | |
| tree | 04d65b63f6062c0e15636da283edfd04f65df6be /tests/modules | |
| parent | e8aa6bd86dcfc67fb2fd5d9bb4319a956097f9c1 (diff) | |
add new apis
Diffstat (limited to 'tests/modules')
| -rw-r--r-- | tests/modules/xml/test.lua | 23 |
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 + |
