forked from pixie-lang/pixie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-json.pxi
More file actions
33 lines (27 loc) · 977 Bytes
/
Copy pathtest-json.pxi
File metadata and controls
33 lines (27 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(ns pixie.tests.parser.test-json
(:require [pixie.test :refer :all]
[pixie.parser.json :as json]))
(deftest test-json-numbers
(assert-table [x y] (assert= (json/read-string x) y)
"1" 1
"1.0" 1.0
"0.1" 0.1
"1.1" 1.1
"1234.5678" 1234.5678
"-1" -1
"-0.1" -0.1
"-1.1" -1.1
"-1234.5678" -1234.5678
"1e1" 1e1))
(deftest test-vectors
(assert-table [x y] (assert= (json/read-string x) y)
"[]" []
"[null]" [nil]
"[1, 2]" [1 2]
"[1, 1.0, null]" [1 1.0 nil]
"[\"foo\", 42]" ["foo" 42]))
(deftest test-maps
(assert-table [x y] (assert= (json/read-string x) y)
"{\"foo\": 42}" {"foo", 42}
"{\"foo\": 42, \"bar\":null}" {"foo" 42
"bar" nil}))