restructure: move el compiler content into lang/
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// json-array-traversal.el — acceptance test for json_get dot-path with array
|
||||
// indices.
|
||||
//
|
||||
// Before fix: json_get("...", "0.field") would substring-search for a literal
|
||||
// key named `"0.field"` and find nothing, returning "".
|
||||
//
|
||||
// After fix: dot-path segments that are all digits are treated as array
|
||||
// indices and the walker descends into the array.
|
||||
|
||||
fn test_array_traversal() -> String {
|
||||
let s: String = "[{\"name\":\"alice\"},{\"name\":\"bob\"}]"
|
||||
let a: String = json_get(s, "0.name")
|
||||
let b: String = json_get(s, "1.name")
|
||||
return a + "," + b
|
||||
}
|
||||
|
||||
fn main() -> Int {
|
||||
let r: String = test_array_traversal()
|
||||
print(r)
|
||||
return 0
|
||||
}
|
||||
Reference in New Issue
Block a user