Skip to content
This repository was archived by the owner on Jan 1, 2023. It is now read-only.

Commit a83a929

Browse files
committed
✅ add runtime check test
1 parent 86dc37f commit a83a929

29 files changed

+200
-78
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"build": "rm -rf dist/** && tsc",
77
"fmt": "prettier --write \"src/**/*.ts\"",
88
"lint": "eslint 'src/**/*.ts' --fix",
9-
"test": "ls test/__fixtures__/**/*_out.js | xargs -L1 node && jest"
9+
"test": "ls test/__fixtures__/**/*.js | xargs -L1 node && jest"
1010
},
1111
"dependencies": {
1212
"@babel/core": "^7.7.7",
@@ -47,7 +47,8 @@
4747
}
4848
},
4949
"lint-staged": {
50-
"src/**/*.ts": ["yarn lint", "yarn fmt", "git add"]
50+
"src/**/*.ts": ["yarn lint", "yarn fmt", "git add"],
51+
"test/**/*.ts": ["yarn lint", "yarn fmt", "git add"]
5152
},
5253
"author": "nd-02110114 <nd.12021218@gmail.com>",
5354
"license": "MIT",

test/__fixtures__/array/array.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

test/__fixtures__/array/array_out.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

test/__fixtures__/array/input.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test1 = [1, "two", {three: 3}]
2+
const test2 = [{one: 1}, {two: 2}, {three: 3}]
3+
const res = [test1, test2]

test/__fixtures__/array/output.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test1 = JSON.parse('[1,"two",{"three":3}]')
2+
const test2 = JSON.parse('[{"one":1},{"two":2},{"three":3}]')
3+
const res = [test1, test2]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test1 = { foo: [null, 10, 'foo'] }
2+
const test2 = { foo: [null, [10, 2], [{ foo: 'foo' }]] }
3+
const res = [test1, test2]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const test1 = JSON.parse('{"foo":[null,10,"foo"]}')
2+
const test2 = JSON.parse('{"foo":[null,[10,2],[{"foo":"foo"}]]}')
3+
const res = [test1, test2]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const test1 = { foo: "fo\'o" }
2+
const test2 = { foo: "fo\"o" }
3+
const test3 = { foo: 'fo\"o' }
4+
const test4 = { foo: 'fo\'o' }
5+
const test5 = { foo: 'fo\to' }
6+
const test6 = { foo: 'fo\fo' }
7+
const test7= { foo: 'fo\ro' }
8+
const test8 = { foo: 'fo\no' }
9+
const test9= { foo: 'fo\bo' }
10+
const test10= { foo: 'fo\r\no' }
11+
const res = [
12+
test1,
13+
test2,
14+
test3,
15+
test4,
16+
test5,
17+
test6,
18+
test7,
19+
test8,
20+
test9,
21+
test10
22+
]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const test1 = JSON.parse('{"foo":"fo\'o"}')
2+
const test2 = JSON.parse('{"foo":"fo\\"o"}')
3+
const test3 = JSON.parse('{"foo":"fo\\"o"}')
4+
const test4 = JSON.parse('{"foo":"fo\'o"}')
5+
const test5 = JSON.parse('{"foo":"fo\\to"}')
6+
const test6 = JSON.parse('{"foo":"fo\\fo"}')
7+
const test7 = JSON.parse('{"foo":"fo\\ro"}')
8+
const test8 = JSON.parse('{"foo":"fo\\no"}')
9+
const test9 = JSON.parse('{"foo":"fo\\bo"}')
10+
const test10 = JSON.parse('{"foo":"fo\\r\\no"}')
11+
const res = [
12+
test1,
13+
test2,
14+
test3,
15+
test4,
16+
test5,
17+
test6,
18+
test7,
19+
test8,
20+
test9,
21+
test10
22+
]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const test1 = { foo: true }
2+
const res = [test1]

0 commit comments

Comments
 (0)