risei 1.1.1 → 1.2.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/README.md +17 -16
- package/index.js +1 -1
- package/package.json +6 -5
- package/system/Risei.js +1 -1
- package/system/TestFinder.js +19 -3
- package/system/TestRunner.js +1 -1
- package/tests/other-tests/ASpoofingFixture.tests.js +0 -242
- package/tests/other-tests/SpoofClassesFixture.tests.js +0 -130
- package/tests/other-tests/SpoofObjectsFixture.tests.js +0 -95
- package/tests/other-tests/SpoofTuple.tests.js +0 -93
- package/tests/other-tests/TotalComparer.tests.js +0 -920
- package/tests/other-tests/package.json +0 -7
- package/tests/risei-tests/ASpoofingFixtureTests.rt.js +0 -51
- package/tests/risei-tests/MomentTests.rt.js +0 -103
- package/tests/risei-tests/SpoofTupleTests.rt.js +0 -274
- package/tests/risei-tests/TestFrameChooserTests.rt.js +0 -74
- package/tests/risei-tests/TestFrameTests.rt.js +0 -84
- package/tests/risei-tests/TestStagesTests.rt.js +0 -99
- package/tests/risei-tests/TestTupleTests.rt.js +0 -140
- package/tests/risei-tests/TotalComparerTests.rt.js +0 -184
- package/tests/risei-tests/TotalCopierTests.rt.js +0 -74
- package/tests/risei-tests/TotalDisplayerTests.rt.js +0 -186
- package/tests/risei-tests/TypeAnalyzerTests.rt.js +0 -29
- package/tests/risei-tests/TypeIdentifierTests.rt.js +0 -44
- package/tests/self-tests/SelfTests.outward-rt.js +0 -583
- package/tests/target-objects/CompositionModel.js +0 -38
- package/tests/target-objects/ConditionalThrowModel.js +0 -11
- package/tests/target-objects/CountModel.js +0 -46
- package/tests/target-objects/DomModel.js +0 -37
- package/tests/target-objects/MixedContents.js +0 -33
- package/tests/target-objects/MutationModel.js +0 -27
- package/tests/target-objects/ObjectCompositionModel.js +0 -34
- package/tests/target-objects/PolySpoofableInner.js +0 -30
- package/tests/target-objects/PolySpoofableOuter.js +0 -52
- package/tests/target-objects/PropertiesModel.js +0 -47
- package/tests/target-objects/Returner.js +0 -9
- package/tests/target-objects/SearchModel.js +0 -25
- package/tests/target-objects/SortModel.js +0 -91
- package/tests/target-objects/SpoofCaller.js +0 -24
- package/tests/target-objects/Spoofable.js +0 -36
- package/tests/target-objects/SpoofableArgsCaller.js +0 -33
- package/tests/target-objects/StateModel.js +0 -34
- package/tests/target-objects/StaticModel.js +0 -17
- package/tests/target-objects/TestableModel.js +0 -47
- package/tests/topic-tests/TopicTests.outward-rt.js +0 -354
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**/
|
|
2
|
-
|
|
3
|
-
import { ATestSource } from "../../node_modules/risei/public/javascript/ATestSource.js";
|
|
4
|
-
import { TotalDisplayer } from "../../system/TotalDisplayer.js";
|
|
5
|
-
import { TestableModel } from "../target-objects/TestableModel.js";
|
|
6
|
-
|
|
7
|
-
export class TotalDisplayerTests extends ATestSource {
|
|
8
|
-
tests = [
|
|
9
|
-
{ on: TotalDisplayer, with: [ ] },
|
|
10
|
-
|
|
11
|
-
// region Individual methods for displays of different types
|
|
12
|
-
|
|
13
|
-
{ of: "displayValue", and: "nospoof" },
|
|
14
|
-
{ for: "Displays an integer as default JS number text.", /* good */
|
|
15
|
-
in: [ 9 ], out: "9" },
|
|
16
|
-
{ for: "Displays a non-integer as default JS number text.", /* good */
|
|
17
|
-
in: [ 6.8 ], out: "6.8" },
|
|
18
|
-
{ for: "Displays a boolean as default JS boolean text.", /* good */
|
|
19
|
-
in: [ false ], out: "false" },
|
|
20
|
-
{ for: "Displays a date as default JS date text.", /* good */
|
|
21
|
-
// Can't use literals, since they fail across time zones.
|
|
22
|
-
in: [ new Date() ], out: Date() },
|
|
23
|
-
|
|
24
|
-
{ of: "displayString", and: "nospoof" },
|
|
25
|
-
{ for: "Displays the arg value with quotes around it.", /* good */
|
|
26
|
-
in: [ "this is a string" ], out: `"this is a string"` },
|
|
27
|
-
|
|
28
|
-
{ of: "displayArray", and: "nospoof" },
|
|
29
|
-
{ for: "Displays an empty array as [].", /* good */
|
|
30
|
-
in: [ [ ] ], out: `[]` },
|
|
31
|
-
{ for: "Displays an array of values as [v,v,v,...].", /* good */
|
|
32
|
-
in: [ [ "a", 2, "three", 4, false, 7.7 ] ], out: `["a",2,"three",4,false,7.7]` },
|
|
33
|
-
{ for: "Displays an array of complex types as [expanded,expanded,...].", /* good */
|
|
34
|
-
in: [ [ { a: 1 }, [ [ "b", "c", new Map([ [ 5, "d" ] ]) ], [ 4, new Set([ 6, "e" ]) ] ] ] ],
|
|
35
|
-
out: `[{ a:1 },[["b","c",Map{5:"d"}],[4,Set{6,"e"}]]]` },
|
|
36
|
-
|
|
37
|
-
{ of: "displayMap", and: "nospoof" },
|
|
38
|
-
{ for: "Displays an empty Map as Map{}.", /* good */
|
|
39
|
-
in: [ new Map([ ]) ], out: `Map{}` },
|
|
40
|
-
{ for: "Displays a Map of values as Map{k:v,k:v,...}.", /* good */
|
|
41
|
-
in: [ new Map([ [ "1", "one" ], [ 2, "B" ] ]) ], out: `Map{"1":"one",2:"B"}` },
|
|
42
|
-
{ for: "Displays a Map of complex types as Map{k:expanded,k:expanded,...}.", /* good */
|
|
43
|
-
in: [ new Map([ [ "array", [ 2, 4, 6, 10 ] ], [ TestableModel, { b: 1, c: 2 } ] ]) ],
|
|
44
|
-
out: `Map{"array":[2,4,6,10],TestableModel:{ b:1, c:2 }}` },
|
|
45
|
-
|
|
46
|
-
{ of: "displaySet", and: "nospoof" },
|
|
47
|
-
{ for: "Displays an empty Set as Set{}.", /* good */
|
|
48
|
-
in: [ new Set([ ]) ], out: `Set{}` },
|
|
49
|
-
{ for: "Displays a Set of values as Set{v,v,...}.", /* good */
|
|
50
|
-
in: [ new Set([ 1, "two", 3.3, true, 5 ]) ], out: `Set{1,"two",3.3,true,5}` },
|
|
51
|
-
{ for: "Displays a Set of complex types as Set{expanded,expanded,...}.", /* good */
|
|
52
|
-
in: [ new Set([ TestableModel, { one: 1, two: 2 }, [ "a", "bc", "d" ], new Map([ [ 8, "H" ] ]) ]) ],
|
|
53
|
-
out: `Set{TestableModel,{ one:1, two:2 },["a","bc","d"],Map{8:"H"}}` },
|
|
54
|
-
|
|
55
|
-
{ of: "displayClass", and: "nospoof" },
|
|
56
|
-
{ for: "Displays a class by name only.", /* good */
|
|
57
|
-
in: [ TestableModel ], out: "TestableModel" },
|
|
58
|
-
|
|
59
|
-
{ of: "displayFunction", and: "nospoof" },
|
|
60
|
-
{ for: "Displays full text of a method definition, minus extra whitespace.", /* good */
|
|
61
|
-
in: [ TestableModel.prototype.instanceMethod ],
|
|
62
|
-
out: "instanceMethod(argOne, argTwo) { return `instance-method-${ argOne }-${ argTwo }`; }" },
|
|
63
|
-
{ for: "Displays full text of a plain function definition, minus extra whitespace.", /* good */
|
|
64
|
-
in: [
|
|
65
|
-
function plain(arg) {
|
|
66
|
-
return `${ arg }`;
|
|
67
|
-
} ],
|
|
68
|
-
out: "function plain(arg) { return `${ arg }`; }" },
|
|
69
|
-
{ for: "Displays full text of an arrow-syntax function definition, minus extra whitespace.", /* good */
|
|
70
|
-
in: [
|
|
71
|
-
() => {
|
|
72
|
-
return "no arg";
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
out: `() => { return "no arg"; }` },
|
|
76
|
-
|
|
77
|
-
{ of: "displayObject", and: "nospoof" },
|
|
78
|
-
{ for: "Displays toString() of an object with a meaningful toString().", /* good */
|
|
79
|
-
in: [ { a: "A-1", b: 27, toString: () => "meaningful" } ], out: "meaningful" },
|
|
80
|
-
{ for: "Displays an empty object without a meaningful toString() as { }.", /* good */
|
|
81
|
-
in: [ { } ], out: `{ }` },
|
|
82
|
-
{ for: "Displays value members of an object without a meaningful toString().", /* good */
|
|
83
|
-
in: [ { a: "A-1", b: 27 } ], out: `{ a:"A-1", b:27 }` },
|
|
84
|
-
{ for: "Displays complex members of an object without a meaningful toString().", /* good */
|
|
85
|
-
in: [ { a: [ "a", "2", { first: 1, second: 2 } ],
|
|
86
|
-
b: new Set([ 2, 11, "50" ]),
|
|
87
|
-
map: new Map([ [1, 0], [2, 6] ]),
|
|
88
|
-
act: () => { return TestableModel; } } ],
|
|
89
|
-
out: `{ a:["a","2",{ first:1, second:2 }], b:Set{2,11,"50"}, map:Map{1:0,2:6}, act:() => { return TestableModel; } }` },
|
|
90
|
-
|
|
91
|
-
{ of: "displayUndefined", and: "nospoof" },
|
|
92
|
-
{ for: "Displays the word \"undefined\".", /* good */
|
|
93
|
-
in: [ undefined ], out: "undefined" },
|
|
94
|
-
|
|
95
|
-
{ of: "displayNull", and: "nospoof" },
|
|
96
|
-
{ for: "Displays the word \"null\".", /* good */
|
|
97
|
-
in: [ null ], out: "null" },
|
|
98
|
-
|
|
99
|
-
// endregion Individual methods for displays of different types
|
|
100
|
-
|
|
101
|
-
// region display()
|
|
102
|
-
|
|
103
|
-
{ of: "display", and: "nospoof" },
|
|
104
|
-
{ for: "Displays an integer as default JS number text.", /* good */
|
|
105
|
-
in: [ 9 ], out: "9" },
|
|
106
|
-
{ for: "Displays a non-integer as default JS number text.", /* good */
|
|
107
|
-
in: [ 6.8 ], out: "6.8" },
|
|
108
|
-
{ for: "Displays a boolean as default JS boolean text.", /* good */
|
|
109
|
-
in: [ false ], out: "false" },
|
|
110
|
-
{ for: "Displays a date as default JS date text.", /* good */
|
|
111
|
-
// Can't use literals, since they fail across time zones.
|
|
112
|
-
in: [ new Date() ], out: Date() },
|
|
113
|
-
|
|
114
|
-
{ for: "Displays the arg value with quotes around it.", /* good */
|
|
115
|
-
in: [ "this is a string" ], out: `"this is a string"` },
|
|
116
|
-
|
|
117
|
-
{ for: "Displays an empty array as [].", /* good */
|
|
118
|
-
in: [ [ ] ], out: `[]` },
|
|
119
|
-
{ for: "Displays an array of values as [v,v,v,...].", /* good */
|
|
120
|
-
in: [ [ "a", 2, "three", 4, false, 7.7 ] ], out: `["a",2,"three",4,false,7.7]` },
|
|
121
|
-
|
|
122
|
-
{ for: "Displays an empty Map as Map{}.", /* good */
|
|
123
|
-
in: [ new Map([ ]) ], out: `Map{}` },
|
|
124
|
-
{ for: "Displays a Map of values as Map{k:v,k:v,...}.", /* good */
|
|
125
|
-
in: [ new Map([ [ "1", "one" ], [ 2, "B" ] ]) ], out: `Map{"1":"one",2:"B"}` },
|
|
126
|
-
|
|
127
|
-
{ for: "Displays an empty Set as Set{}.", /* good */
|
|
128
|
-
in: [ new Set([ ]) ], out: `Set{}` },
|
|
129
|
-
{ for: "Displays a Set of values as Set{v,v,...}.", /* good */
|
|
130
|
-
in: [ new Set([ 1, "two", 3.3, true, 5 ]) ], out: `Set{1,"two",3.3,true,5}` },
|
|
131
|
-
|
|
132
|
-
{ for: "Displays a class by name only.", /* good */
|
|
133
|
-
in: [ TestableModel ], out: "TestableModel" },
|
|
134
|
-
|
|
135
|
-
{ for: "Displays full text of a method definition, minus extra whitespace.", /* good */
|
|
136
|
-
in: [ TestableModel.prototype.instanceMethod ],
|
|
137
|
-
out: "instanceMethod(argOne, argTwo) { return `instance-method-${ argOne }-${ argTwo }`; }" },
|
|
138
|
-
{ for: "Displays full text of a plain function definition, minus extra whitespace.", /* good */
|
|
139
|
-
in: [
|
|
140
|
-
function plain(arg) {
|
|
141
|
-
return `${ arg }`;
|
|
142
|
-
} ],
|
|
143
|
-
out: "function plain(arg) { return `${ arg }`; }" },
|
|
144
|
-
{ for: "Displays full text of an arrow-syntax function definition, minus extra whitespace.", /* good */
|
|
145
|
-
in: [
|
|
146
|
-
() => {
|
|
147
|
-
return "no arg";
|
|
148
|
-
}
|
|
149
|
-
],
|
|
150
|
-
out: `() => { return "no arg"; }` },
|
|
151
|
-
|
|
152
|
-
{ for: "Displays toString() of an object with a meaningful toString().", /* good */
|
|
153
|
-
in: [ { a: "A-1", b: 27, toString: () => "meaningful" } ], out: "meaningful" },
|
|
154
|
-
{ for: "Displays an empty object without a meaningful toString() as { }.", /* good */
|
|
155
|
-
in: [ { } ], out: `{ }` },
|
|
156
|
-
{ for: "Displays value members of an object without a meaningful toString().", /* good */
|
|
157
|
-
in: [ { a: "A-1", b: 27 } ], out: `{ a:"A-1", b:27 }` },
|
|
158
|
-
|
|
159
|
-
{ for: "Displays the word \"undefined\".", /* good */
|
|
160
|
-
in: [ undefined ], out: "undefined" },
|
|
161
|
-
|
|
162
|
-
{ for: "Displays the word \"null\".", /* good */
|
|
163
|
-
in: [ null ], out: "null" },
|
|
164
|
-
|
|
165
|
-
{ for: "Displays an array of complex types as [expanded,expanded,...].", /* good */
|
|
166
|
-
in: [ [ { a: 1 }, [ [ "b", "c", new Map([ [ 5, "d" ] ]) ], [ 4, new Set([ 6, "e" ]) ] ] ] ],
|
|
167
|
-
out: `[{ a:1 },[["b","c",Map{5:"d"}],[4,Set{6,"e"}]]]` },
|
|
168
|
-
|
|
169
|
-
{ for: "Displays a Map of complex types as Map{k:expanded,k:expanded,...}.", /* good */
|
|
170
|
-
in: [ new Map([ [ "array", [ 2, 4, 6, 10 ] ], [ TestableModel, { b: 1, c: 2 } ] ]) ],
|
|
171
|
-
out: `Map{"array":[2,4,6,10],TestableModel:{ b:1, c:2 }}` },
|
|
172
|
-
|
|
173
|
-
{ for: "Displays a Set of complex types as Set{expanded,expanded,...}.", /* good */
|
|
174
|
-
in: [ new Set([ TestableModel, { one: 1, two: 2 }, [ "a", "bc", "d" ], new Map([ [ 8, "H" ] ]) ]) ],
|
|
175
|
-
out: `Set{TestableModel,{ one:1, two:2 },["a","bc","d"],Map{8:"H"}}` },
|
|
176
|
-
|
|
177
|
-
{ for: "Displays complex members of an object without a meaningful toString().", /* good */
|
|
178
|
-
in: [ { a: [ "a", "2", { first: 1, second: 2 } ],
|
|
179
|
-
b: new Set([ 2, 11, "50" ]),
|
|
180
|
-
map: new Map([ [1, 0], [2, 6] ]),
|
|
181
|
-
act: () => { return TestableModel; } } ],
|
|
182
|
-
out: `{ a:["a","2",{ first:1, second:2 }], b:Set{2,11,"50"}, map:Map{1:0,2:6}, act:() => { return TestableModel; } }` },
|
|
183
|
-
|
|
184
|
-
// endregion display()
|
|
185
|
-
];
|
|
186
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**/
|
|
2
|
-
|
|
3
|
-
import { ATestSource } from "../../node_modules/risei/public/javascript/ATestSource.js";
|
|
4
|
-
import { TypeAnalyzer } from "../../system/TypeAnalyzer.js";
|
|
5
|
-
import { PropertiesModel } from "../target-objects/PropertiesModel.js";
|
|
6
|
-
|
|
7
|
-
export class TypeAnalyzerTests extends ATestSource {
|
|
8
|
-
tests = [
|
|
9
|
-
{ on: TypeAnalyzer, with: [ PropertiesModel ] },
|
|
10
|
-
|
|
11
|
-
{ of: "memberIsProperty", and: "nospoof" },
|
|
12
|
-
{ for: "When arg is the name of an instance value property, returns true.", /* good */
|
|
13
|
-
in: [ "valueProp" ], out: true },
|
|
14
|
-
{ for: "When arg is the name of an instance accessor property, returns true.", /* good */
|
|
15
|
-
in: [ "accessorProp" ], out: true },
|
|
16
|
-
{ for: "When arg is the name of an instance method, returns false.", /* good */
|
|
17
|
-
in: [ "instanceMethod" ], out: false },
|
|
18
|
-
{ for: "When arg is \"constructor()\", returns false.",
|
|
19
|
-
in: [ "constructor" ], out: false },
|
|
20
|
-
|
|
21
|
-
{ for: "When arg is the name of a static value property, returns true.", /* good */
|
|
22
|
-
in: [ "staticValueProp" ], out: true },
|
|
23
|
-
{ for: "When arg is the name of a static accessor property, returns true.", /* good */
|
|
24
|
-
in: [ "staticAccessorProp" ], out: true },
|
|
25
|
-
{ for: "When arg is the name of a static method, returns false.", /* good */
|
|
26
|
-
in: [ "staticMethod" ], out: false },
|
|
27
|
-
];
|
|
28
|
-
}
|
|
29
|
-
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**/
|
|
2
|
-
|
|
3
|
-
import { ATestSource } from "../../node_modules/risei/public/javascript/ATestSource.js";
|
|
4
|
-
import { TypeIdentifier } from "../../system/TypeIdentifier.js";
|
|
5
|
-
import { Types } from "../../system/Types.js";
|
|
6
|
-
import { TestableModel } from "../target-objects/TestableModel.js";
|
|
7
|
-
|
|
8
|
-
let namedFunction = function() { return "named"; };
|
|
9
|
-
|
|
10
|
-
export class TypeIdentifierTests extends ATestSource {
|
|
11
|
-
tests = [
|
|
12
|
-
{ on: TypeIdentifier, with: [ ] },
|
|
13
|
-
{ of: "identify", and: "nospoof" },
|
|
14
|
-
|
|
15
|
-
{ for: "When the arg is a number, returns Types.isValue, AKA \"value\".", /* good */
|
|
16
|
-
in: [ 12 ], out: Types.isValue },
|
|
17
|
-
{ for: "When the arg is a boolean, returns Types.isValue, AKA \"value\".", /* good */
|
|
18
|
-
in: [ true ], out: Types.isValue },
|
|
19
|
-
{ for: "When the arg is a string, returns Types.isString, AKA \"string\".", /* good */
|
|
20
|
-
in: [ "12" ], out: Types.isString },
|
|
21
|
-
{ for: "When the arg is an array, returns Types.isArray, AKA \"array\".", /* good */
|
|
22
|
-
in: [ [ 2, 4, 9 ] ], out: Types.isArray },
|
|
23
|
-
{ for: "When the arg is a Set, returns Types.isSet, AKA \"set\".", /* good */
|
|
24
|
-
in: [ new Set([ 8, 15, 20 ]) ], out: Types.isSet },
|
|
25
|
-
{ for: "When the arg is a Map, returns Types.isMap, AKA \"map\".", /* good */
|
|
26
|
-
in: [ new Map([ [ "a", "A" ], [ "b", "B" ] ]) ], out: Types.isMap },
|
|
27
|
-
{ for: "When the arg is a regular object, returns Types.isObject, AKA \"object\".", /* good */
|
|
28
|
-
in: [ { firstProp: 1, secondProp: "2" } ], out: Types.isObject },
|
|
29
|
-
{ for: "When the arg is a `function`-syntax anonymous Function, returns Types.isFunction, AKA \"function\".", /* good */
|
|
30
|
-
in: [ function() { return 7; } ], out: Types.isFunction },
|
|
31
|
-
{ for: "When the arg is a `function`-syntax named Function, returns Types.isFunction, AKA \"function\".", /* good */
|
|
32
|
-
in: [ namedFunction ], out: Types.isFunction },
|
|
33
|
-
{ for: "When the arg is an arrow-syntax Function, returns Types.isFunction, AKA \"function\".", /* good */
|
|
34
|
-
in: [ () => { return "8"; } ], out: Types.isFunction },
|
|
35
|
-
{ for: "When the arg is a Class, returns Types.isClass, AKA \"class\".", /* good */
|
|
36
|
-
in: [ TestableModel ], out: Types.isClass },
|
|
37
|
-
{ for: "When the arg is a Date, returns Types.isDate, AKA \"date\".", /* good */
|
|
38
|
-
in: [ new Date("November 20, 2011") ], out: Types.isDate },
|
|
39
|
-
{ for: "When the arg is a null, returns Types.isNull, AKA \"null\".", /* good */
|
|
40
|
-
in: [ null ], out: Types.isNull },
|
|
41
|
-
{ for: "When the arg is an undefined, returns Types.isUndefined, AKA \"undefined\".", /* good */
|
|
42
|
-
in: [ undefined ], out: Types.isUndefined }
|
|
43
|
-
];
|
|
44
|
-
}
|