Files
launcher/jsonx/jsonx_wbtest.mbt
T
SpriteandClaude Sonnet 5.5 28e0284d9b Add the pure MoonBit core: grid, gestures, updater, vdom, app
grid: packing, pinning, resize steps (port of Layout.js and app.py's grid logic).
gesture: pointer state machine (tap, long press, drag, release, swipe).
updater: release/version parsing and the update decision.
vdom: pure virtual DOM with an HTML-text renderer for tests.
app: Elm-style Model/Msg/update/view with effects as data, persistence (JSON
layout, import of the old WebView build's localStorage), drawer/search, menus,
drag and resize. 60 headless tests drive it through pointer input.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 00:55:16 +00:00

14 lines
429 B
MoonBit

///|
test "accessors with defaults" {
let j = parse("{\"a\":\"x\",\"n\":3,\"b\":true,\"l\":[1,2],\"o\":{}}").unwrap()
assert_eq(str(j, "a"), "x")
assert_eq(str(j, "zz", default="d"), "d")
assert_eq(int(j, "n"), 3)
assert_eq(int(j, "b"), 1)
assert_eq(int(j, "a", default=-1), -1)
assert_true(bool(j, "b"))
assert_eq(arr(j, "l").length(), 2)
assert_eq(arr(j, "o").length(), 0)
assert_true(parse("{") is None)
}