feat: support scalar qjson.decode roots#122
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR extends ChangesTop-level scalar decode support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
qjson.decode()to return top-level scalar JSON roots via the existing cursor decode path.Fixes #120
Test Plan
DYLD_LIBRARY_PATH=./target/release LUA_PATH='./lua/?.lua;;' LUA_CPATH='./vendor/lua-cjson/?.so;./target/release/lib?.dylib;./target/release/lib?.so;./?.so;;' /opt/homebrew/bin/luajit -e 'local qjson=require("qjson"); assert(qjson.decode("42") == 42); assert(qjson.decode("3.14") == 3.14); assert(qjson.decode("true") == true); assert(qjson.decode("false") == false); assert(qjson.decode("null") == qjson.null); assert(qjson.decode("\"hello\"") == "hello"); local ok = pcall(qjson.decode, ""); assert(not ok); print("focused-ok")'PATH=/Users/yuanshengwang/.luarocks/bin:$PATH make testmake lintcargo test --release --no-default-featurescargo test --features test-panic --releaseSummary by CodeRabbit
New Features
decode()now supports top-level JSON scalar values (numbers, strings, booleans, and null) in addition to objects and arrays.Tests