feat: add cJSON and SQLite amalgamation source files under deps/
Add the cJSON library (cJSON.c, cJSON.h) and SQLite amalgamation (sqlite3.c, sqlite3.h, sqlite3ext.h, shell.c) as vendored dependencies in the deps/ directory for use by the project build system.
This commit is contained in:
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
import "json" for Json
|
||||
|
||||
var obj = Json.parse("{\"name\":\"test\",\"value\":42}")
|
||||
System.print(obj["name"]) // expect: test
|
||||
System.print(obj["value"]) // expect: 42
|
||||
|
||||
var arr = Json.parse("[1,2,3]")
|
||||
System.print(arr[0]) // expect: 1
|
||||
System.print(arr.count) // expect: 3
|
||||
|
||||
var nested = Json.parse("{\"list\":[1,2],\"obj\":{\"a\":\"b\"}}")
|
||||
System.print(nested["list"][1]) // expect: 2
|
||||
System.print(nested["obj"]["a"]) // expect: b
|
||||
|
||||
System.print(Json.parse("null") == null) // expect: true
|
||||
System.print(Json.parse("true")) // expect: true
|
||||
System.print(Json.parse("false")) // expect: false
|
||||
System.print(Json.parse("\"hello\"")) // expect: hello
|
||||
System.print(Json.parse("3.14")) // expect: 3.14
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
import "json" for Json
|
||||
|
||||
System.print(Json.stringify(null)) // expect: null
|
||||
System.print(Json.stringify(true)) // expect: true
|
||||
System.print(Json.stringify(false)) // expect: false
|
||||
System.print(Json.stringify(42)) // expect: 42
|
||||
System.print(Json.stringify(3.14)) // expect: 3.14
|
||||
System.print(Json.stringify("hello")) // expect: "hello"
|
||||
System.print(Json.stringify([1, 2, 3])) // expect: [1,2,3]
|
||||
System.print(Json.stringify({"a": 1})) // expect: {"a":1}
|
||||
|
||||
var obj = {"name": "test", "value": 42}
|
||||
var json = Json.stringify(obj)
|
||||
System.print(json.contains("\"name\"")) // expect: true
|
||||
System.print(json.contains("\"test\"")) // expect: true
|
||||
|
||||
var nested = {"list": [1, 2], "flag": true}
|
||||
var nestedJson = Json.stringify(nested)
|
||||
System.print(nestedJson.contains("[1,2]")) // expect: true
|
||||
System.print(nestedJson.contains("true")) // expect: true
|
||||
|
||||
System.print(Json.stringify("line\nbreak")) // expect: "line\nbreak"
|
||||
Reference in New Issue
Block a user