@litert/typeguard 1.0.1 → 1.3.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +16 -0
- package/lib/BuiltInTypeCompiler.d.ts +4 -4
- package/lib/BuiltInTypeCompiler.d.ts.map +1 -1
- package/lib/BuiltInTypeCompiler.js +167 -166
- package/lib/BuiltInTypeCompiler.js.map +1 -1
- package/lib/BuiltInTypes.d.ts +1 -1
- package/lib/BuiltInTypes.js +37 -36
- package/lib/BuiltInTypes.js.map +1 -1
- package/lib/Common.d.ts +27 -10
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js +1 -1
- package/lib/Compiler.d.ts +2 -2
- package/lib/Compiler.d.ts.map +1 -1
- package/lib/Compiler.js +159 -102
- package/lib/Compiler.js.map +1 -1
- package/lib/Context.d.ts +6 -5
- package/lib/Context.d.ts.map +1 -1
- package/lib/Context.js +11 -7
- package/lib/Context.js.map +1 -1
- package/lib/FilterCompiler.d.ts +5 -5
- package/lib/FilterCompiler.d.ts.map +1 -1
- package/lib/FilterCompiler.js +25 -24
- package/lib/FilterCompiler.js.map +1 -1
- package/lib/InlineCompiler.d.ts +12 -5
- package/lib/InlineCompiler.d.ts.map +1 -1
- package/lib/InlineCompiler.js +18 -6
- package/lib/InlineCompiler.js.map +1 -1
- package/lib/Internal.d.ts +6 -4
- package/lib/Internal.d.ts.map +1 -1
- package/lib/Internal.js +12 -10
- package/lib/Internal.js.map +1 -1
- package/lib/Modifiers.d.ts +1 -1
- package/lib/Modifiers.js +2 -1
- package/lib/Modifiers.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.js +19 -7
- package/lib/index.js.map +1 -1
- package/lib/langs/JavaScript.d.ts +2 -2
- package/lib/langs/JavaScript.d.ts.map +1 -1
- package/lib/langs/JavaScript.js +55 -29
- package/lib/langs/JavaScript.js.map +1 -1
- package/package.json +17 -13
- package/src/examples/quick-start.ts +172 -0
- package/src/lib/BuiltInTypeCompiler.ts +171 -171
- package/src/lib/BuiltInTypes.ts +36 -36
- package/src/lib/Common.ts +49 -10
- package/src/lib/Compiler.ts +354 -247
- package/src/lib/Context.ts +11 -13
- package/src/lib/FilterCompiler.ts +84 -84
- package/src/lib/InlineCompiler.ts +41 -15
- package/src/lib/Internal.ts +17 -13
- package/src/lib/Modifiers.ts +2 -2
- package/src/lib/index.ts +5 -5
- package/src/lib/langs/JavaScript.ts +84 -31
- package/src/test/00-all.ts +10 -10
- package/src/test/01-elemental-types.ts +1111 -1110
- package/src/test/02-array-and-list.ts +75 -75
- package/src/test/03-tuple.ts +87 -87
- package/src/test/04-from-string.ts +849 -848
- package/src/test/05-string-asserts.ts +422 -422
- package/src/test/06-structure.ts +107 -107
- package/src/test/07-modifiers.ts +151 -42
- package/src/test/08-map-and-dict.ts +46 -46
- package/src/test/09-exceptions.ts +30 -9
- package/src/test/abstracts.ts +83 -45
- package/dist/typeguard.amd.d.ts +0 -588
- package/dist/typeguard.amd.d.ts.map +0 -1
- package/dist/typeguard.amd.js +0 -2069
- package/dist/typeguard.amd.js.map +0 -1
- package/dist/typeguard.system.d.ts +0 -588
- package/dist/typeguard.system.d.ts.map +0 -1
- package/dist/typeguard.system.js +0 -2185
- package/dist/typeguard.system.js.map +0 -1
- package/src/samples/quick-start.ts +0 -52
- package/tsconfig-amd.json +0 -72
- package/tsconfig-systemjs.json +0 -72
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2022 Angus Fenying <fenying@litert.org>
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -20,176 +20,176 @@ import {
|
|
|
20
20
|
ITestSuite,
|
|
21
21
|
assertItem,
|
|
22
22
|
addRule
|
|
23
|
-
} from
|
|
23
|
+
} from './abstracts';
|
|
24
24
|
|
|
25
25
|
const testItems: ITestSuite = {
|
|
26
26
|
|
|
27
|
-
name:
|
|
27
|
+
name: 'List & Array',
|
|
28
28
|
sections: [
|
|
29
29
|
|
|
30
30
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
'name': 'String list',
|
|
32
|
+
'rule': ['$.list', 'string'],
|
|
33
|
+
'items': [
|
|
34
34
|
{
|
|
35
|
-
inputName:
|
|
36
|
-
inputValue: [
|
|
35
|
+
inputName: '[string]',
|
|
36
|
+
inputValue: ['fff'],
|
|
37
37
|
expect: true
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
inputName:
|
|
41
|
-
inputValue: [
|
|
40
|
+
inputName: '[string,string]',
|
|
41
|
+
inputValue: ['fff', 'ggg'],
|
|
42
42
|
expect: true
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
inputName:
|
|
46
|
-
inputValue: [
|
|
45
|
+
inputName: '[string,int]',
|
|
46
|
+
inputValue: ['fff', 123],
|
|
47
47
|
expect: false
|
|
48
48
|
},
|
|
49
49
|
...defaultItemss({
|
|
50
|
-
|
|
50
|
+
'empty array': true
|
|
51
51
|
})
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
'name': 'Fixed-length array with 1 element.',
|
|
56
|
+
'rule': ['$.array', 1, 'string'],
|
|
57
|
+
'items': [
|
|
58
58
|
{
|
|
59
|
-
inputName:
|
|
60
|
-
inputValue: [
|
|
59
|
+
inputName: '[string]',
|
|
60
|
+
inputValue: ['fff'],
|
|
61
61
|
expect: true
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
inputName:
|
|
65
|
-
inputValue: [
|
|
64
|
+
inputName: '[string,string]',
|
|
65
|
+
inputValue: ['fff', 'ggg'],
|
|
66
66
|
expect: false
|
|
67
67
|
},
|
|
68
68
|
...defaultItemss({})
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
'name': 'Fixed-length array with 2 different-type elements.',
|
|
73
|
+
'rule': ['$.array', 2, 'string', 'int'],
|
|
74
|
+
'items': [
|
|
75
75
|
{
|
|
76
|
-
inputName:
|
|
77
|
-
inputValue: [
|
|
76
|
+
inputName: '[string]',
|
|
77
|
+
inputValue: ['fff'],
|
|
78
78
|
expect: false
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
|
-
inputName:
|
|
82
|
-
inputValue: [
|
|
81
|
+
inputName: '[string,string]',
|
|
82
|
+
inputValue: ['fff', 'ggg'],
|
|
83
83
|
expect: true
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
inputName:
|
|
87
|
-
inputValue: [
|
|
86
|
+
inputName: '[string,int]',
|
|
87
|
+
inputValue: ['fff', 312],
|
|
88
88
|
expect: true
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
|
-
inputName:
|
|
91
|
+
inputName: '[int,int]',
|
|
92
92
|
inputValue: [333, 312],
|
|
93
93
|
expect: true
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
|
-
inputName:
|
|
97
|
-
inputValue: [333,
|
|
96
|
+
inputName: '[int,string]',
|
|
97
|
+
inputValue: [333, 'ddsadsa'],
|
|
98
98
|
expect: true
|
|
99
99
|
},
|
|
100
100
|
...defaultItemss({})
|
|
101
101
|
]
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
'name': 'Variable-length array with at least 1 element',
|
|
105
|
+
'rule': ['$.array', [1], 'string'],
|
|
106
|
+
'items': [
|
|
107
107
|
{
|
|
108
|
-
inputName:
|
|
109
|
-
inputValue: [
|
|
108
|
+
inputName: '[string]',
|
|
109
|
+
inputValue: ['fff'],
|
|
110
110
|
expect: true
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
|
-
inputName:
|
|
114
|
-
inputValue: [
|
|
113
|
+
inputName: '[string,string]',
|
|
114
|
+
inputValue: ['fff', 'ggg'],
|
|
115
115
|
expect: true
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
|
-
inputName:
|
|
119
|
-
inputValue: [
|
|
118
|
+
inputName: '[string,int]',
|
|
119
|
+
inputValue: ['fff', 123],
|
|
120
120
|
expect: false
|
|
121
121
|
},
|
|
122
122
|
...defaultItemss({})
|
|
123
123
|
]
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
'name': 'Variable-length array with 1 ~ 3 elements',
|
|
127
|
+
'rule': ['$.array', [1, 3], 'string'],
|
|
128
|
+
'items': [
|
|
129
129
|
{
|
|
130
|
-
inputName:
|
|
131
|
-
inputValue: [
|
|
130
|
+
inputName: '[string]',
|
|
131
|
+
inputValue: ['fff'],
|
|
132
132
|
expect: true
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
|
-
inputName:
|
|
136
|
-
inputValue: [
|
|
135
|
+
inputName: '[string,string]',
|
|
136
|
+
inputValue: ['fff', 'ggg'],
|
|
137
137
|
expect: true
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
|
-
inputName:
|
|
141
|
-
inputValue: [
|
|
140
|
+
inputName: '[string,string,string]',
|
|
141
|
+
inputValue: ['fff', 'ggg', 'ggg'],
|
|
142
142
|
expect: true
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
|
-
inputName:
|
|
146
|
-
inputValue: [
|
|
145
|
+
inputName: '[string,string,string,string]',
|
|
146
|
+
inputValue: ['fff', 'ggg', 'ggg', 'fffa'],
|
|
147
147
|
expect: false
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
|
-
inputName:
|
|
151
|
-
inputValue: [
|
|
150
|
+
inputName: '[string,int]',
|
|
151
|
+
inputValue: ['fff', 123],
|
|
152
152
|
expect: false
|
|
153
153
|
},
|
|
154
154
|
...defaultItemss({})
|
|
155
155
|
]
|
|
156
156
|
},
|
|
157
157
|
addRule({
|
|
158
|
-
|
|
158
|
+
'a->[]': 'string'
|
|
159
159
|
}, [
|
|
160
160
|
assertItem([], false),
|
|
161
|
-
assertItem({
|
|
162
|
-
assertItem({
|
|
163
|
-
assertItem({
|
|
161
|
+
assertItem({ 'a': [] }, true),
|
|
162
|
+
assertItem({ 'a': [1] }, false),
|
|
163
|
+
assertItem({ 'a': ['1'] }, true)
|
|
164
164
|
]),
|
|
165
165
|
addRule({
|
|
166
|
-
|
|
166
|
+
'a->[3]': 'string'
|
|
167
167
|
}, [
|
|
168
168
|
assertItem([], false),
|
|
169
|
-
assertItem({
|
|
170
|
-
assertItem({
|
|
171
|
-
assertItem({
|
|
172
|
-
assertItem({
|
|
169
|
+
assertItem({ 'a': [] }, false),
|
|
170
|
+
assertItem({ 'a': [1, 1, 2] }, false),
|
|
171
|
+
assertItem({ 'a': ['1', 'f', 'c'] }, true),
|
|
172
|
+
assertItem({ 'a': ['1', 'f', 'c', 'c'] }, false)
|
|
173
173
|
]),
|
|
174
174
|
addRule({
|
|
175
|
-
|
|
175
|
+
'a->[3,]': 'string'
|
|
176
176
|
}, [
|
|
177
177
|
assertItem([], false),
|
|
178
|
-
assertItem({
|
|
179
|
-
assertItem({
|
|
180
|
-
assertItem({
|
|
181
|
-
assertItem({
|
|
178
|
+
assertItem({ 'a': [] }, false),
|
|
179
|
+
assertItem({ 'a': [1, 1, 2] }, false),
|
|
180
|
+
assertItem({ 'a': ['1', 'f', 'c'] }, true),
|
|
181
|
+
assertItem({ 'a': ['1', 'f', 'c', 'c'] }, true)
|
|
182
182
|
]),
|
|
183
183
|
addRule({
|
|
184
|
-
|
|
184
|
+
'a->[3,5]': 'string'
|
|
185
185
|
}, [
|
|
186
186
|
assertItem([], false),
|
|
187
|
-
assertItem({
|
|
188
|
-
assertItem({
|
|
189
|
-
assertItem({
|
|
190
|
-
assertItem({
|
|
191
|
-
assertItem({
|
|
192
|
-
assertItem({
|
|
187
|
+
assertItem({ 'a': [] }, false),
|
|
188
|
+
assertItem({ 'a': [1, 1, 2] }, false),
|
|
189
|
+
assertItem({ 'a': ['1', 'f', 'c'] }, true),
|
|
190
|
+
assertItem({ 'a': ['1', 'f', 'c', 'c'] }, true),
|
|
191
|
+
assertItem({ 'a': ['1', 'f', 'c', 'c', '5'] }, true),
|
|
192
|
+
assertItem({ 'a': ['1', 'f', 'c', 'c', '5', 'c'] }, false)
|
|
193
193
|
])
|
|
194
194
|
],
|
|
195
195
|
};
|
package/src/test/03-tuple.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2022 Angus Fenying <fenying@litert.org>
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,203 +14,203 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { createTestDefinition, defaultItemss, ITestSuite } from
|
|
17
|
+
import { createTestDefinition, defaultItemss, ITestSuite } from './abstracts';
|
|
18
18
|
|
|
19
19
|
const testItems: ITestSuite = {
|
|
20
20
|
|
|
21
|
-
name:
|
|
21
|
+
name: 'Tuple',
|
|
22
22
|
sections: [
|
|
23
23
|
|
|
24
24
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
'name': 'Simple tuple',
|
|
26
|
+
'rule': ['$.tuple', 'string', 'int'],
|
|
27
|
+
'items': [
|
|
28
28
|
{
|
|
29
|
-
inputName:
|
|
30
|
-
inputValue: [
|
|
29
|
+
inputName: '[string]',
|
|
30
|
+
inputValue: ['fff'],
|
|
31
31
|
expect: false
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
inputName:
|
|
35
|
-
inputValue: [
|
|
34
|
+
inputName: '[string,int]',
|
|
35
|
+
inputValue: ['fff', 1213],
|
|
36
36
|
expect: true
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
inputName:
|
|
40
|
-
inputValue: [123,
|
|
39
|
+
inputName: '[int, string]',
|
|
40
|
+
inputValue: [123, 'fff'],
|
|
41
41
|
expect: false
|
|
42
42
|
},
|
|
43
43
|
...defaultItemss({
|
|
44
|
-
|
|
44
|
+
'empty array': false
|
|
45
45
|
})
|
|
46
46
|
]
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
'name': 'Empty tuple',
|
|
50
|
+
'rule': ['$.tuple'],
|
|
51
|
+
'items': [
|
|
52
52
|
{
|
|
53
|
-
inputName:
|
|
54
|
-
inputValue: [
|
|
53
|
+
inputName: '[string]',
|
|
54
|
+
inputValue: ['fff'],
|
|
55
55
|
expect: false
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
inputName:
|
|
59
|
-
inputValue: [
|
|
58
|
+
inputName: '[string,int]',
|
|
59
|
+
inputValue: ['fff', 1213],
|
|
60
60
|
expect: false
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
|
-
inputName:
|
|
64
|
-
inputValue: [123,
|
|
63
|
+
inputName: '[int, string]',
|
|
64
|
+
inputValue: [123, 'fff'],
|
|
65
65
|
expect: false
|
|
66
66
|
},
|
|
67
67
|
...defaultItemss({
|
|
68
|
-
|
|
68
|
+
'empty array': true
|
|
69
69
|
})
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
'name': 'Umlimited omittable tuple',
|
|
74
|
+
'rule': ['$.tuple', 'string', 'int', '...'],
|
|
75
|
+
'items': [
|
|
76
76
|
{
|
|
77
|
-
inputName:
|
|
78
|
-
inputValue: [
|
|
77
|
+
inputName: '[string]',
|
|
78
|
+
inputValue: ['fff'],
|
|
79
79
|
expect: true
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
|
-
inputName:
|
|
83
|
-
inputValue: [
|
|
82
|
+
inputName: '[string,int]',
|
|
83
|
+
inputValue: ['fff', 1213],
|
|
84
84
|
expect: true
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
|
-
inputName:
|
|
88
|
-
inputValue: [
|
|
87
|
+
inputName: '[string,int,int]',
|
|
88
|
+
inputValue: ['fff', 1213, 233],
|
|
89
89
|
expect: true
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
inputName:
|
|
93
|
-
inputValue: [123,
|
|
92
|
+
inputName: '[int, string]',
|
|
93
|
+
inputValue: [123, 'fff'],
|
|
94
94
|
expect: false
|
|
95
95
|
},
|
|
96
96
|
...defaultItemss({
|
|
97
|
-
|
|
97
|
+
'empty array': false
|
|
98
98
|
})
|
|
99
99
|
]
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
'name': 'Limited omittable tuple',
|
|
103
|
+
'rule': ['$.tuple', 'string', 'int', '...3', 'string'],
|
|
104
|
+
'items': [
|
|
105
105
|
{
|
|
106
|
-
inputName:
|
|
107
|
-
inputValue: [
|
|
106
|
+
inputName: '[string,int,int,int,string]',
|
|
107
|
+
inputValue: ['fff', 1, 3, 5, 'ccc'],
|
|
108
108
|
expect: true
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
|
-
inputName:
|
|
112
|
-
inputValue: [
|
|
111
|
+
inputName: '[string,int]',
|
|
112
|
+
inputValue: ['fff', 1213],
|
|
113
113
|
expect: false
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
|
-
inputName:
|
|
117
|
-
inputValue: [
|
|
116
|
+
inputName: '[string,int,string]',
|
|
117
|
+
inputValue: ['fff', 1213, 'ccc'],
|
|
118
118
|
expect: false
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
|
-
inputName:
|
|
122
|
-
inputValue: [
|
|
121
|
+
inputName: '[string,int,int]',
|
|
122
|
+
inputValue: ['fff', 1213, 233],
|
|
123
123
|
expect: false
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
|
-
inputName:
|
|
127
|
-
inputValue: [123,
|
|
126
|
+
inputName: '[int, string]',
|
|
127
|
+
inputValue: [123, 'fff'],
|
|
128
128
|
expect: false
|
|
129
129
|
},
|
|
130
130
|
...defaultItemss({
|
|
131
|
-
|
|
131
|
+
'empty array': false
|
|
132
132
|
})
|
|
133
133
|
]
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
'name': 'Mixed omitted tuple',
|
|
137
|
+
'rule': ['$.tuple', 'string', 'int', '...4', 'string', '...'],
|
|
138
|
+
'items': [
|
|
139
139
|
{
|
|
140
|
-
inputName:
|
|
141
|
-
inputValue: [
|
|
140
|
+
inputName: '[string,int,int,int,int,string]',
|
|
141
|
+
inputValue: ['fff', 1, 3, 5, 2, 'ccc'],
|
|
142
142
|
expect: true
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
|
-
inputName:
|
|
146
|
-
inputValue: [
|
|
145
|
+
inputName: '[string,int,int,int,int,string,string]',
|
|
146
|
+
inputValue: ['fff', 1, 3, 5, 2, 'ccc', 'aaa'],
|
|
147
147
|
expect: true
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
|
-
inputName:
|
|
151
|
-
inputValue: [
|
|
150
|
+
inputName: '[string,int,int,int,int]',
|
|
151
|
+
inputValue: ['fff', 1, 3, 5, 2],
|
|
152
152
|
expect: true
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
|
-
inputName:
|
|
156
|
-
inputValue: [
|
|
155
|
+
inputName: '[string,int,int,int]',
|
|
156
|
+
inputValue: ['fff', 1, 3, 5],
|
|
157
157
|
expect: false
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
|
-
inputName:
|
|
161
|
-
inputValue: [
|
|
160
|
+
inputName: '[string,int]',
|
|
161
|
+
inputValue: ['fff', 1213],
|
|
162
162
|
expect: false
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
|
-
inputName:
|
|
166
|
-
inputValue: [
|
|
165
|
+
inputName: '[string,int,string]',
|
|
166
|
+
inputValue: ['fff', 1213, 'ccc'],
|
|
167
167
|
expect: false
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
|
-
inputName:
|
|
171
|
-
inputValue: [
|
|
170
|
+
inputName: '[string,int,int]',
|
|
171
|
+
inputValue: ['fff', 1213, 233],
|
|
172
172
|
expect: false
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
|
-
inputName:
|
|
176
|
-
inputValue: [123,
|
|
175
|
+
inputName: '[int, string]',
|
|
176
|
+
inputValue: [123, 'fff'],
|
|
177
177
|
expect: false
|
|
178
178
|
},
|
|
179
179
|
...defaultItemss({
|
|
180
|
-
|
|
180
|
+
'empty array': false
|
|
181
181
|
})
|
|
182
182
|
]
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
'name': 'Invalid syntax: [\'$.tuple\', \'...\']',
|
|
186
|
+
'rule': ['$.tuple', '...'],
|
|
187
|
+
'items': [
|
|
188
188
|
{
|
|
189
|
-
inputName:
|
|
190
|
-
inputValue:
|
|
191
|
-
expect:
|
|
189
|
+
inputName: 'any',
|
|
190
|
+
inputValue: 'any',
|
|
191
|
+
expect: 'throw'
|
|
192
192
|
}
|
|
193
193
|
]
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
'name': 'Invalid syntax: [\'$.tuple\', \'string\', \'...\', \'...\']',
|
|
197
|
+
'rule': ['$.tuple', 'string', '...', '...'],
|
|
198
|
+
'items': [
|
|
199
199
|
{
|
|
200
|
-
inputName:
|
|
201
|
-
inputValue:
|
|
202
|
-
expect:
|
|
200
|
+
inputName: 'any',
|
|
201
|
+
inputValue: 'any',
|
|
202
|
+
expect: 'throw'
|
|
203
203
|
}
|
|
204
204
|
]
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
'name': 'Invalid syntax: [\'$.tuple\', \'string\', \'...d\']',
|
|
208
|
+
'rule': ['$.tuple', 'string', '...d'],
|
|
209
|
+
'items': [
|
|
210
210
|
{
|
|
211
|
-
inputName:
|
|
212
|
-
inputValue:
|
|
213
|
-
expect:
|
|
211
|
+
inputName: 'any',
|
|
212
|
+
inputValue: 'any',
|
|
213
|
+
expect: 'throw'
|
|
214
214
|
}
|
|
215
215
|
]
|
|
216
216
|
}
|