diff options
Diffstat (limited to 'test/run.scm')
-rw-r--r-- | test/run.scm | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/test/run.scm b/test/run.scm index 58f1085..6d8f9f0 100644 --- a/test/run.scm +++ b/test/run.scm @@ -2,14 +2,14 @@ (json-object? (json-object))) (test-assert "json-object should meet json-object?" - (json-object? (json-object '("name" . "alice") - '("age" . 26)))) + (json-object? (json-object '(name . "alice") + '(age . 26)))) -(test-not "json-object should not meet json-list?" - (json-list? (json-object '("x" . 5)))) +(test-assert "json-object should not meet json-list?" + (not (json-list? (json-object '(x . 5))))) -(test-not "json-list should not meet json-object?" - (json-object? (json-list 1 2 3))) +(test-assert "json-list should not meet json-object?" + (not (json-object? (json-list 1 2 3)))) (test-assert "json-list should meet json-list?" (json-list? (json-list))) @@ -30,46 +30,52 @@ (json-value? #t)) (test-assert "json-objects should meet json-value?" - (json-value? (json-object '("x" . 5)))) + (json-value? (json-object '(x . 5)))) (test-assert "json-lists should meet json-value?" (json-value? (json-list 1 2 3))) (test-assert "json-object-contains-key? should return true when the object contains the key" - (json-object-contains-key? (json-object '("x" . 5)) "x")) + (json-object-contains-key? (json-object '(x . 5)) 'x)) -(test-not "json-object-contains-key? should return false when the object does not contain the key" - (json-object-contains-key? (json-object '("x" . 5)) "y")) +(test-assert "json-object-contains-key? should return false when the object does not contain the key" + (not (json-object-contains-key? (json-object '(x . 5)) 'y))) (test-assert "the null string should meet json-null? when parsed" (json-null? (string->json "null"))) -(test "numbers should parse to their scheme values" +(test-equal "numbers should parse to their scheme values" 5 (string->json "5")) -(test "true should parse to the boolean true" +(test-equal "true should parse to the boolean true" #t (string->json "true")) -(test "false should parse to the boolean false" +(test-equal "false should parse to the boolean false" #f (string->json "false")) -(test "string->json should properly parse string values" +(test-equal "string->json should properly parse string values" "hello" (string->json "\"hello\"")) (test-assert "string->json should return an object with the correct keys" - (json-object-contains-key? (string->json "{\"x\": 5}") "x")) + (json-object-contains-key? (string->json "{\"x\": 5}") 'x)) -(test-not "string->json should return an object without the incorrect keys" - (json-object-contains-key? (string->json "{\"x\": 5}") "y")) +(test-assert "string->json should return an object without the incorrect keys" + (not (json-object-contains-key? (string->json "{\"x\": 5}") 'y))) (test-assert "json-object-contains-key? should be met when the associated value is false" - (json-object-contains-key? (json-object '("x" . #f)) "x")) + (json-object-contains-key? (json-object '(x . #f)) 'x)) (test-assert "json-object-contains-key? should be met when the associated value is an empty json-list" - (json-object-contains-key? (json-object `("x" . ,(json-list))) "x")) + (json-object-contains-key? (json-object `(x . ,(json-list))) 'x)) (test-assert "json-object-contains-key? should be met when the associated value is an empty json-object" - (json-object-contains-key? (json-object `("x" . ,(json-object))) "x")) + (json-object-contains-key? (json-object `(x . ,(json-object))) 'x)) (test-assert "json-object-contains-key? should be met when the associated value is json-null" - (json-object-contains-key? (json-object `("x" . ,json-null)) "x")) + (json-object-contains-key? (json-object `(x . ,json-null)) 'x)) + +;; (json (object)) ; => {} + +;; (json (list)) ; => [] + +;; (json null) ; => null |