yukigo 0.1.0 → 0.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.
Files changed (144) hide show
  1. package/.mocharc.json +3 -3
  2. package/CHANGELOG.md +26 -0
  3. package/README.md +193 -199
  4. package/dist/analyzer/GraphBuilder.d.ts +29 -0
  5. package/dist/analyzer/GraphBuilder.js +99 -0
  6. package/dist/analyzer/index.d.ts +11 -23
  7. package/dist/analyzer/index.js +100 -58
  8. package/dist/analyzer/inspections/functional/functional.d.ts +44 -0
  9. package/dist/analyzer/inspections/functional/functional.js +149 -0
  10. package/dist/analyzer/inspections/functional/smells.d.ts +16 -0
  11. package/dist/analyzer/inspections/functional/smells.js +98 -0
  12. package/dist/analyzer/inspections/{generic.d.ts → generic/generic.d.ts} +70 -43
  13. package/dist/analyzer/inspections/generic/generic.js +604 -0
  14. package/dist/analyzer/inspections/generic/smells.d.ts +61 -0
  15. package/dist/analyzer/inspections/generic/smells.js +349 -0
  16. package/dist/analyzer/inspections/imperative/imperative.d.ts +35 -0
  17. package/dist/analyzer/inspections/imperative/imperative.js +109 -0
  18. package/dist/analyzer/inspections/imperative/smells.d.ts +16 -0
  19. package/dist/analyzer/inspections/imperative/smells.js +58 -0
  20. package/dist/analyzer/inspections/logic/logic.d.ts +32 -0
  21. package/dist/analyzer/inspections/logic/logic.js +96 -0
  22. package/dist/analyzer/inspections/logic/smells.d.ts +15 -0
  23. package/dist/analyzer/inspections/logic/smells.js +60 -0
  24. package/dist/analyzer/inspections/object/object.d.ts +88 -0
  25. package/dist/analyzer/inspections/object/object.js +319 -0
  26. package/dist/analyzer/inspections/object/smells.d.ts +30 -0
  27. package/dist/analyzer/inspections/object/smells.js +135 -0
  28. package/dist/analyzer/utils.d.ts +26 -4
  29. package/dist/analyzer/utils.js +71 -13
  30. package/dist/index.d.ts +1 -0
  31. package/dist/index.js +1 -0
  32. package/dist/interpreter/components/EnvBuilder.d.ts +9 -5
  33. package/dist/interpreter/components/EnvBuilder.js +100 -30
  34. package/dist/interpreter/components/Operations.d.ts +4 -4
  35. package/dist/interpreter/components/Operations.js +17 -2
  36. package/dist/interpreter/components/PatternMatcher.d.ts +47 -17
  37. package/dist/interpreter/components/PatternMatcher.js +264 -119
  38. package/dist/interpreter/components/RuntimeContext.d.ts +35 -0
  39. package/dist/interpreter/components/RuntimeContext.js +93 -0
  40. package/dist/interpreter/components/TestRunner.d.ts +18 -0
  41. package/dist/interpreter/components/TestRunner.js +103 -0
  42. package/dist/interpreter/components/Visitor.d.ts +63 -57
  43. package/dist/interpreter/components/Visitor.js +508 -173
  44. package/dist/interpreter/components/logic/LogicEngine.d.ts +29 -0
  45. package/dist/interpreter/components/logic/LogicEngine.js +259 -0
  46. package/dist/interpreter/components/logic/LogicResolver.d.ts +53 -0
  47. package/dist/interpreter/components/logic/LogicResolver.js +471 -0
  48. package/dist/interpreter/components/logic/LogicTranslator.d.ts +14 -0
  49. package/dist/interpreter/components/logic/LogicTranslator.js +99 -0
  50. package/dist/interpreter/components/runtimes/FunctionRuntime.d.ts +12 -0
  51. package/dist/interpreter/components/runtimes/FunctionRuntime.js +147 -0
  52. package/dist/interpreter/components/runtimes/LazyRuntime.d.ts +19 -0
  53. package/dist/interpreter/components/runtimes/LazyRuntime.js +269 -0
  54. package/dist/interpreter/components/runtimes/ObjectRuntime.d.ts +35 -0
  55. package/dist/interpreter/components/runtimes/ObjectRuntime.js +126 -0
  56. package/dist/interpreter/entities.d.ts +105 -0
  57. package/dist/interpreter/entities.js +96 -0
  58. package/dist/interpreter/errors.d.ts +1 -1
  59. package/dist/interpreter/index.d.ts +4 -12
  60. package/dist/interpreter/index.js +10 -13
  61. package/dist/interpreter/trampoline.d.ts +17 -0
  62. package/dist/interpreter/trampoline.js +38 -0
  63. package/dist/interpreter/utils.d.ts +4 -7
  64. package/dist/interpreter/utils.js +25 -17
  65. package/dist/tester/index.d.ts +25 -0
  66. package/dist/tester/index.js +108 -0
  67. package/dist/utils/helpers.d.ts +0 -4
  68. package/dist/utils/helpers.js +20 -24
  69. package/package.json +2 -2
  70. package/src/analyzer/GraphBuilder.ts +142 -0
  71. package/src/analyzer/index.ts +185 -132
  72. package/src/analyzer/inspections/functional/functional.ts +121 -0
  73. package/src/analyzer/inspections/functional/smells.ts +102 -0
  74. package/src/analyzer/inspections/{generic.ts → generic/generic.ts} +581 -499
  75. package/src/analyzer/inspections/generic/smells.ts +365 -0
  76. package/src/analyzer/inspections/imperative/imperative.ts +101 -0
  77. package/src/analyzer/inspections/imperative/smells.ts +54 -0
  78. package/src/analyzer/inspections/logic/logic.ts +90 -0
  79. package/src/analyzer/inspections/logic/smells.ts +54 -0
  80. package/src/analyzer/inspections/{object.ts → object/object.ts} +264 -282
  81. package/src/analyzer/inspections/object/smells.ts +144 -0
  82. package/src/analyzer/utils.ts +109 -26
  83. package/src/index.ts +3 -2
  84. package/src/interpreter/components/EnvBuilder.ts +202 -97
  85. package/src/interpreter/components/Operations.ts +99 -81
  86. package/src/interpreter/components/PatternMatcher.ts +475 -254
  87. package/src/interpreter/components/RuntimeContext.ts +119 -0
  88. package/src/interpreter/components/TestRunner.ts +151 -0
  89. package/src/interpreter/components/Visitor.ts +1065 -493
  90. package/src/interpreter/components/logic/LogicEngine.ts +519 -0
  91. package/src/interpreter/components/logic/LogicResolver.ts +858 -0
  92. package/src/interpreter/components/logic/LogicTranslator.ts +149 -0
  93. package/src/interpreter/components/runtimes/FunctionRuntime.ts +227 -0
  94. package/src/interpreter/components/runtimes/LazyRuntime.ts +334 -0
  95. package/src/interpreter/components/runtimes/ObjectRuntime.ts +224 -0
  96. package/src/interpreter/errors.ts +47 -47
  97. package/src/interpreter/index.ts +52 -59
  98. package/src/interpreter/trampoline.ts +71 -0
  99. package/src/interpreter/utils.ts +84 -79
  100. package/src/tester/index.ts +128 -0
  101. package/src/utils/helpers.ts +67 -73
  102. package/tests/analyzer/functional.spec.ts +207 -221
  103. package/tests/analyzer/generic.spec.ts +178 -100
  104. package/tests/analyzer/helpers.spec.ts +83 -83
  105. package/tests/analyzer/logic.spec.ts +237 -292
  106. package/tests/analyzer/oop.spec.ts +323 -338
  107. package/tests/analyzer/transitive.spec.ts +166 -0
  108. package/tests/interpreter/EnvBuilder.spec.ts +183 -178
  109. package/tests/interpreter/FunctionRuntime.spec.ts +223 -234
  110. package/tests/interpreter/LazyRuntime.spec.ts +225 -190
  111. package/tests/interpreter/LogicEngine.spec.ts +327 -194
  112. package/tests/interpreter/LogicSubstitution.spec.ts +80 -0
  113. package/tests/interpreter/ObjectRuntime.spec.ts +606 -0
  114. package/tests/interpreter/Operations.spec.ts +220 -220
  115. package/tests/interpreter/PatternSystem.spec.ts +213 -189
  116. package/tests/interpreter/Tests.spec.ts +122 -0
  117. package/tests/interpreter/interpreter.spec.ts +991 -937
  118. package/tests/tester/Tester.spec.ts +153 -0
  119. package/tsconfig.build.json +15 -7
  120. package/tsconfig.json +25 -17
  121. package/dist/analyzer/inspections/functional.d.ts +0 -46
  122. package/dist/analyzer/inspections/functional.js +0 -123
  123. package/dist/analyzer/inspections/generic.js +0 -427
  124. package/dist/analyzer/inspections/imperative.d.ts +0 -37
  125. package/dist/analyzer/inspections/imperative.js +0 -105
  126. package/dist/analyzer/inspections/logic.d.ts +0 -49
  127. package/dist/analyzer/inspections/logic.js +0 -140
  128. package/dist/analyzer/inspections/object.d.ts +0 -83
  129. package/dist/analyzer/inspections/object.js +0 -235
  130. package/dist/interpreter/components/FunctionRuntime.d.ts +0 -8
  131. package/dist/interpreter/components/FunctionRuntime.js +0 -52
  132. package/dist/interpreter/components/LazyRuntime.d.ts +0 -7
  133. package/dist/interpreter/components/LazyRuntime.js +0 -75
  134. package/dist/interpreter/components/LogicEngine.d.ts +0 -21
  135. package/dist/interpreter/components/LogicEngine.js +0 -152
  136. package/dist/interpreter/components/LogicResolver.d.ts +0 -11
  137. package/dist/interpreter/components/LogicResolver.js +0 -87
  138. package/src/analyzer/inspections/functional.ts +0 -159
  139. package/src/analyzer/inspections/imperative.ts +0 -129
  140. package/src/analyzer/inspections/logic.ts +0 -166
  141. package/src/interpreter/components/FunctionRuntime.ts +0 -79
  142. package/src/interpreter/components/LazyRuntime.ts +0 -97
  143. package/src/interpreter/components/LogicEngine.ts +0 -227
  144. package/src/interpreter/components/LogicResolver.ts +0 -130
@@ -1,100 +1,178 @@
1
- import { expect } from "chai";
2
- import {
3
- TypesParameterAs,
4
- TypesReturnAs,
5
- } from "../../src/analyzer/inspections/generic.js";
6
- import {
7
- TypeSignature,
8
- ParameterizedType,
9
- SymbolPrimitive,
10
- SimpleType,
11
- } from "yukigo-ast";
12
- import { executeVisitor } from "../../src/analyzer/utils.js";
13
-
14
- describe("Generic Inspections Type Checks", () => {
15
- const createTypeSignature = (name: string, params: string[], ret: string) => {
16
- const identifier = new SymbolPrimitive(name);
17
- const inputTypes = params.map((p) => {
18
- const t = new SimpleType(p, []);
19
- t.toString = () => p;
20
- return t;
21
- });
22
-
23
- const returnType = new SimpleType(ret, []);
24
- returnType.toString = () => ret;
25
-
26
- const body = new ParameterizedType(inputTypes, returnType, []);
27
- return new TypeSignature(identifier, body);
28
- };
29
-
30
- describe("TypesParameterAs", () => {
31
- it("should find a match when parameter type matches at correct index", () => {
32
- // f :: Int -> String -> Bool
33
- const node = createTypeSignature("f", ["Int", "String"], "Bool");
34
- const visitor = new TypesParameterAs("f", 0, "Int");
35
-
36
- expect(executeVisitor(node, visitor)).to.eq(true);
37
- });
38
-
39
- it("should find a match at a specific index (2nd parameter)", () => {
40
- // f :: Int -> String -> Bool
41
- const node = createTypeSignature("f", ["Int", "String"], "Bool");
42
- const visitor = new TypesParameterAs("f", 1, "String");
43
-
44
- expect(executeVisitor(node, visitor)).to.eq(true);
45
- });
46
-
47
- it("should NOT throw if parameter index is out of bounds", () => {
48
- const node = createTypeSignature("f", ["Int"], "Bool");
49
- const visitor = new TypesParameterAs("f", 2, "Int");
50
-
51
- expect(executeVisitor(node, visitor)).to.eq(false);
52
- });
53
-
54
- it("should NOT throw if type does not match", () => {
55
- const node = createTypeSignature("f", ["Int"], "Bool");
56
- const visitor = new TypesParameterAs("f", 1, "String");
57
-
58
- expect(executeVisitor(node, visitor)).to.eq(false);
59
- });
60
-
61
- it("should NOT throw if binding name does not match", () => {
62
- const node = createTypeSignature("g", ["Int"], "Bool");
63
- const visitor = new TypesParameterAs("f", 1, "Int");
64
-
65
- expect(executeVisitor(node, visitor)).to.eq(false);
66
- });
67
- });
68
-
69
- describe("TypesReturnAs", () => {
70
- it("should find a match when return type matches", () => {
71
- // f :: Int -> Bool
72
- const node = createTypeSignature("f", ["Int"], "Bool");
73
- const visitor = new TypesReturnAs("f", "Bool");
74
-
75
- expect(executeVisitor(node, visitor)).to.eq(true);
76
- });
77
-
78
- it("should handle complex return types", () => {
79
- // f :: Int -> (Int, Int)
80
- const node = createTypeSignature("f", ["Int"], "(Int, Int)");
81
- const visitor = new TypesReturnAs("f", "(Int, Int)");
82
-
83
- expect(executeVisitor(node, visitor)).to.eq(true);
84
- });
85
-
86
- it("should NOT throw if return type does not match", () => {
87
- const node = createTypeSignature("f", ["Int"], "Bool");
88
- const visitor = new TypesReturnAs("f", "Int");
89
-
90
- expect(executeVisitor(node, visitor)).to.eq(false);
91
- });
92
-
93
- it("should NOT throw if binding name does not match", () => {
94
- const node = createTypeSignature("g", ["Int"], "Bool");
95
- const visitor = new TypesReturnAs("f", "Bool");
96
-
97
- expect(executeVisitor(node, visitor)).to.eq(false);
98
- });
99
- });
100
- });
1
+ import { expect } from "chai";
2
+ import { Analyzer, InspectionRule } from "../../src/analyzer/index.js";
3
+ import {
4
+ TypeSignature,
5
+ ParameterizedType,
6
+ SymbolPrimitive,
7
+ SimpleType,
8
+ Function,
9
+ } from "yukigo-ast";
10
+
11
+ describe("Generic Inspections", () => {
12
+ const createTypeSignature = (name: string, params: string[], ret: string) => {
13
+ const identifier = new SymbolPrimitive(name);
14
+ const inputTypes = params.map((p) => {
15
+ const t = new SimpleType(p, []);
16
+ t.toString = () => p;
17
+ return t;
18
+ });
19
+
20
+ const returnType = new SimpleType(ret, []);
21
+ returnType.toString = () => ret;
22
+
23
+ const body = new ParameterizedType(inputTypes, returnType, []);
24
+ return new TypeSignature(identifier, body);
25
+ };
26
+
27
+ it("should allow expectations without args", () => {
28
+ const ast = [new Function(new SymbolPrimitive("func"), [])];
29
+ const rules: InspectionRule[] = [
30
+ {
31
+ binding: "func",
32
+ inspection: "HasBinding",
33
+ expected: true
34
+ },
35
+ ];
36
+ const analyzer = new Analyzer();
37
+ const results = analyzer.analyze(ast, rules);
38
+ expect(results[0].passed).to.be.true;
39
+ });
40
+ describe("TypesParameterAs", () => {
41
+ it("should find a match when parameter type matches at correct index", () => {
42
+ const ast = [createTypeSignature("f", ["Int", "String"], "Bool")];
43
+ const rules: InspectionRule[] = [
44
+ {
45
+ inspection: "TypesParameterAs",
46
+ binding: "f",
47
+ args: ["0", "Int"],
48
+ expected: true,
49
+ },
50
+ ];
51
+ const analyzer = new Analyzer();
52
+ const results = analyzer.analyze(ast, rules);
53
+ expect(results[0].passed).to.be.true;
54
+ });
55
+
56
+ it("should find a match at a specific index (2nd parameter)", () => {
57
+ const ast = [createTypeSignature("f", ["Int", "String"], "Bool")];
58
+ const rules: InspectionRule[] = [
59
+ {
60
+ inspection: "TypesParameterAs",
61
+ binding: "f",
62
+ args: ["1", "String"],
63
+ expected: true,
64
+ },
65
+ ];
66
+ const analyzer = new Analyzer();
67
+ const results = analyzer.analyze(ast, rules);
68
+ expect(results[0].passed).to.be.true;
69
+ });
70
+
71
+ it("should NOT pass if parameter index is out of bounds", () => {
72
+ const ast = [createTypeSignature("f", ["Int"], "Bool")];
73
+ const rules: InspectionRule[] = [
74
+ {
75
+ inspection: "TypesParameterAs",
76
+ binding: "f",
77
+ args: ["2", "Int"],
78
+ expected: true,
79
+ },
80
+ ];
81
+ const analyzer = new Analyzer();
82
+ const results = analyzer.analyze(ast, rules);
83
+ expect(results[0].passed).to.be.false;
84
+ });
85
+
86
+ it("should NOT pass if type does not match", () => {
87
+ const ast = [createTypeSignature("f", ["Int"], "Bool")];
88
+ const rules: InspectionRule[] = [
89
+ {
90
+ inspection: "TypesParameterAs",
91
+ binding: "f",
92
+ args: ["0", "String"],
93
+ expected: true,
94
+ },
95
+ ];
96
+ const analyzer = new Analyzer();
97
+ const results = analyzer.analyze(ast, rules);
98
+ expect(results[0].passed).to.be.false;
99
+ });
100
+
101
+ it("should NOT pass if binding name does not match", () => {
102
+ const ast = [createTypeSignature("g", ["Int"], "Bool")];
103
+ const rules: InspectionRule[] = [
104
+ {
105
+ inspection: "TypesParameterAs",
106
+ binding: "f",
107
+ args: ["0", "Int"],
108
+ expected: true,
109
+ },
110
+ ];
111
+ const analyzer = new Analyzer();
112
+ const results = analyzer.analyze(ast, rules);
113
+ expect(results[0].passed).to.be.false;
114
+ });
115
+ });
116
+
117
+ describe("TypesReturnAs", () => {
118
+ it("should find a match when return type matches", () => {
119
+ const ast = [createTypeSignature("f", ["Int"], "Bool")];
120
+ const rules: InspectionRule[] = [
121
+ {
122
+ inspection: "TypesReturnAs",
123
+ binding: "f",
124
+ args: ["Bool"],
125
+ expected: true,
126
+ },
127
+ ];
128
+ const analyzer = new Analyzer();
129
+ const results = analyzer.analyze(ast, rules);
130
+ expect(results[0].passed).to.be.true;
131
+ });
132
+
133
+ it("should handle complex return types", () => {
134
+ const ast = [createTypeSignature("f", ["Int"], "(Int, Int)")];
135
+ const rules: InspectionRule[] = [
136
+ {
137
+ inspection: "TypesReturnAs",
138
+ binding: "f",
139
+ args: ["(Int, Int)"],
140
+ expected: true,
141
+ },
142
+ ];
143
+ const analyzer = new Analyzer();
144
+ const results = analyzer.analyze(ast, rules);
145
+ expect(results[0].passed).to.be.true;
146
+ });
147
+
148
+ it("should NOT pass if return type does not match", () => {
149
+ const ast = [createTypeSignature("f", ["Int"], "Bool")];
150
+ const rules: InspectionRule[] = [
151
+ {
152
+ inspection: "TypesReturnAs",
153
+ binding: "f",
154
+ args: ["Int"],
155
+ expected: true,
156
+ },
157
+ ];
158
+ const analyzer = new Analyzer();
159
+ const results = analyzer.analyze(ast, rules);
160
+ expect(results[0].passed).to.be.false;
161
+ });
162
+
163
+ it("should NOT pass if binding name does not match", () => {
164
+ const ast = [createTypeSignature("g", ["Int"], "Bool")];
165
+ const rules: InspectionRule[] = [
166
+ {
167
+ inspection: "TypesReturnAs",
168
+ binding: "f",
169
+ args: ["Bool"],
170
+ expected: true,
171
+ },
172
+ ];
173
+ const analyzer = new Analyzer();
174
+ const results = analyzer.analyze(ast, rules);
175
+ expect(results[0].passed).to.be.false;
176
+ });
177
+ });
178
+ });
@@ -1,83 +1,83 @@
1
- import { MulangAdapter } from "../../src/index.js";
2
- import { isYukigoPrimitive, NumberPrimitive, Otherwise } from "yukigo-ast";
3
- import { assert } from "chai";
4
-
5
- describe("Helpers Spec", () => {
6
- it("translates correctly mulang's expectations", () => {
7
- const mulangAdapter = new MulangAdapter();
8
- const mulangExpectations = `
9
- expectations:
10
- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
11
- binding: squareList
12
- inspection: HasBinding
13
- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
14
- binding: squareList
15
- inspection: HasLambdaExpression
16
- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
17
- binding: square
18
- inspection: HasArithmetic
19
- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
20
- binding: doble
21
- inspection: Not:HasBinding
22
- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
23
- binding: square
24
- inspection: Uses:x
25
- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
26
- binding: squareList
27
- inspection: Uses:map
28
- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
29
- binding: squareList
30
- inspection: Not:Uses:map`;
31
-
32
- const yukigoExpectations =
33
- mulangAdapter.translateMulangExpectations(mulangExpectations);
34
- assert.deepEqual(yukigoExpectations, [
35
- {
36
- inspection: "HasBinding",
37
- binding: "squareList",
38
- args: [],
39
- expected: true,
40
- },
41
- {
42
- inspection: "HasLambdaExpression",
43
- binding: "squareList",
44
- args: [],
45
- expected: true,
46
- },
47
- {
48
- inspection: "HasArithmetic",
49
- binding: "square",
50
- args: [],
51
- expected: true,
52
- },
53
- {
54
- inspection: "HasBinding",
55
- binding: "doble",
56
- args: [],
57
- expected: false,
58
- },
59
- {
60
- inspection: "Uses",
61
- binding: "square",
62
- args: ["x"],
63
- expected: true,
64
- },
65
- {
66
- inspection: "Uses",
67
- binding: "squareList",
68
- args: ["map"],
69
- expected: true,
70
- },
71
- {
72
- inspection: "Uses",
73
- binding: "squareList",
74
- args: ["map"],
75
- expected: false,
76
- },
77
- ]);
78
- });
79
- it("detects correctly YukigoPrimitive", () => {
80
- assert.isFalse(isYukigoPrimitive(new Otherwise()));
81
- assert.isTrue(isYukigoPrimitive(new NumberPrimitive(4)));
82
- });
83
- });
1
+ import { MulangAdapter } from "../../src/index.js";
2
+ import { isYukigoPrimitive, NumberPrimitive, Otherwise } from "yukigo-ast";
3
+ import { assert } from "chai";
4
+
5
+ describe("Helpers Spec", () => {
6
+ it("translates correctly mulang's expectations", () => {
7
+ const mulangAdapter = new MulangAdapter();
8
+ const mulangExpectations = `
9
+ expectations:
10
+ - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
11
+ binding: squareList
12
+ inspection: HasBinding
13
+ - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
14
+ binding: squareList
15
+ inspection: HasLambdaExpression
16
+ - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
17
+ binding: square
18
+ inspection: HasArithmetic
19
+ - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
20
+ binding: doble
21
+ inspection: Not:HasBinding
22
+ - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
23
+ binding: square
24
+ inspection: Uses:x
25
+ - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
26
+ binding: squareList
27
+ inspection: Uses:map
28
+ - !ruby/hash:ActiveSupport::HashWithIndifferentAccess
29
+ binding: squareList
30
+ inspection: Not:Uses:map`;
31
+
32
+ const yukigoExpectations =
33
+ mulangAdapter.translateMulangExpectations(mulangExpectations);
34
+ assert.deepEqual(yukigoExpectations, [
35
+ {
36
+ inspection: "HasBinding",
37
+ binding: "squareList",
38
+ args: [],
39
+ expected: true,
40
+ },
41
+ {
42
+ inspection: "HasLambdaExpression",
43
+ binding: "squareList",
44
+ args: [],
45
+ expected: true,
46
+ },
47
+ {
48
+ inspection: "HasArithmetic",
49
+ binding: "square",
50
+ args: [],
51
+ expected: true,
52
+ },
53
+ {
54
+ inspection: "HasBinding",
55
+ binding: "doble",
56
+ args: [],
57
+ expected: false,
58
+ },
59
+ {
60
+ inspection: "Uses",
61
+ binding: "square",
62
+ args: ["x"],
63
+ expected: true,
64
+ },
65
+ {
66
+ inspection: "Uses",
67
+ binding: "squareList",
68
+ args: ["map"],
69
+ expected: true,
70
+ },
71
+ {
72
+ inspection: "Uses",
73
+ binding: "squareList",
74
+ args: ["map"],
75
+ expected: false,
76
+ },
77
+ ]);
78
+ });
79
+ it("detects correctly YukigoPrimitive", () => {
80
+ assert.isFalse(isYukigoPrimitive(new Otherwise()));
81
+ assert.isTrue(isYukigoPrimitive(new NumberPrimitive(4)));
82
+ });
83
+ });