This repository was archived by the owner on Nov 7, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathjavaParser.test.ts
More file actions
401 lines (370 loc) · 20.9 KB
/
Copy pathjavaParser.test.ts
File metadata and controls
401 lines (370 loc) · 20.9 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
import { readdirSync, readFileSync, statSync } from 'node:fs'
import { join } from 'node:path'
import { describe, expect, it } from 'vitest'
import type { LiveLabels } from '../src/core/codeGenerator'
import { setTextLines, insertAfterSibling } from '../src/core/editing'
import { parseLiveJava } from '../src/core/javaParser'
import { documentFromJava, mergeLiveJava, plainLiveJava, type JavaForm } from '../src/core/liveSource'
import { ElementType, makeElement, type VSDocument } from '../src/core/model'
import { decodeDocument } from '../src/core/xmlCodec'
import { SimulationEngine } from '../src/core/simulation'
import { onlyLineBreaksMissing, sameOutput } from '../src/core/exerciseCheck'
import { generateCode } from '../src/core/codeGenerator'
import { indentJava } from '../src/core/javaIndent'
const labels: LiveLabels = { condition: 'Bedingung', selector: 'Wert', code: 'Dein Code', start: 'Startwert', step: 'Schritt', end: 'Ende' }
const parse = (src: string, subprograms?: Set<string>) => parseLiveJava(src, labels, { subprograms })
const doc = (src: string): VSDocument => documentFromJava({ caption: '', elements: [] }, parse(src))
const forms: JavaForm[] = [
{ asClass: false, withMain: false },
{ asClass: false, withMain: true },
{ asClass: true, withMain: false },
{ asClass: true, withMain: true },
]
const types = (src: string) => parse(src).elements.map((e) => e.type)
/** Alle Struktogramme im Repo: Beispiele, Lektionen, Übungen. */
function diagramFiles(dir: string, out: string[] = []): string[] {
for (const name of readdirSync(dir)) {
if (name === 'node_modules' || name.startsWith('.')) continue
const path = join(dir, name)
if (statSync(path).isDirectory()) diagramFiles(path, out)
else if (name.endsWith('.visustruct')) out.push(path)
}
return out
}
describe('Java tippen → Struktogramm', () => {
it('der Knopf „Einrücken“ lässt erzeugten Code unverändert', () => {
for (const file of diagramFiles(join(__dirname, '..', '..'))) {
const original = decodeDocument(readFileSync(file, 'utf8'))
for (const form of forms) {
const code = plainLiveJava(original, labels, form)
expect(indentJava(code), `${file} ${JSON.stringify(form)}`).toBe(code)
}
}
})
it('jedes Struktogramm im Repo: Code → Struktogramm → derselbe Code', () => {
const files = diagramFiles(join(__dirname, '..', '..'))
expect(files.length).toBeGreaterThan(100)
for (const file of files) {
const original = decodeDocument(readFileSync(file, 'utf8'))
for (const form of forms) {
const code = plainLiveJava(original, labels, form)
const back = documentFromJava(original, parse(code))
expect(plainLiveJava(back, labels, form), `${file} ${JSON.stringify(form)}`).toBe(code)
expect(back.caption, file).toBe(original.caption)
}
const code = plainLiveJava(original, labels)
const parsed = parse(code)
// Fehlendes `;` erzeugt der Generator selbst bei Pseudocode wie „Switch on the kettle“.
// Übungen „Warum läuft das nicht?“ starten absichtlich mit falscher Schreibweise (`system.out`, `.Length`).
if (!file.endsWith('-laeuft-nicht-start.visustruct')) expect(parsed.problems.filter((p) => p.arg !== ';'), file).toEqual([])
}
})
it('Grundformen werden zu den passenden Kästen', () => {
const src = [
'int x = 5;',
'System.out.println("Hallo " + x);',
'if (x > 3) { x--; } else { x++; }',
'while (x < 10) { x++; }',
'do { x--; } while (x > 0);',
'for (int i = 0; i < 3; i++) { x += i; }',
'while (true) { break; }',
'switch (x) { case 1 -> { x = 2; } default -> { x = 0; } }',
].join('\n')
expect(types(src)).toEqual([
ElementType.anweisung,
ElementType.anweisung,
ElementType.verzweigung,
ElementType.whileSchleife,
ElementType.doUntilSchleife,
ElementType.forSchleife,
ElementType.endlosschleife,
ElementType.fallauswahl,
])
const els = parse(src).elements
expect(els[0].textLines).toEqual(['int x = 5'])
expect(els[1].textLines).toEqual(['output: "Hallo " + x'])
expect(els[5].textLines).toEqual(['int i = 0', 'i < 3', 'i++'])
expect(els[7].cases?.map((c) => c.name)).toEqual(['1', 'default'])
})
it('println ist schon beim Tippen eine Ausgabe', () => {
expect(parse('System.out.println();').elements[0].textLines).toEqual(['output: '])
expect(parse('System.out.println(').elements[0].textLines).toEqual(['output: '])
expect(parse('System.out.println("Hal').elements[0].textLines).toEqual(['output: "Hal'])
expect(plainLiveJava(doc('System.out.println();'), labels)).toBe('System.out.println();')
})
it('Eingabe mit Hinweis wird ein Eingabe-Kasten', () => {
const els = parse('System.out.println("Wie alt bist du?");\nint alter = scanner.nextInt();').elements
expect(els.map((e) => e.textLines)).toEqual([['input: int alter "Wie alt bist du?"']])
expect(parse('System.out.println("n: ");\nint n = scanner.nextInt();').elements[0].textLines).toEqual(['input: int n'])
expect(parse('String w = scanner.nextLine();').elements[0].textLines).toEqual(['input: String w'])
})
it('Klasse mit main und Unterprogramm-Kopf', () => {
const cls = parse('import java.util.Scanner;\npublic class A {\n public static void main(String[] args) {\n int x = 1;\n }\n}')
expect(cls.caption).toBeUndefined()
expect(cls.elements[0].textLines).toEqual(['int x = 1'])
const method = parse('public static int quadrat(int x) {\n return x * x;\n}')
expect(method.caption).toBe('int quadrat(int x)')
expect(method.elements[0].textLines).toEqual(['return x * x'])
})
it('Klasse und main: Titel = Klassenname, in beide Richtungen', () => {
const doc0: VSDocument = { caption: 'Rechner', elements: [makeElement(ElementType.anweisung, { textLines: ['input: int x'] })] }
expect(plainLiveJava(doc0, labels, { asClass: true, withMain: true })).toBe(
[
'import java.util.Scanner;',
'',
'public class Rechner {',
' public static void main(String[] args) {',
' Scanner scanner = new Scanner(System.in);',
'',
' System.out.println("x: ");',
' int x = scanner.nextInt();',
' }',
'}',
].join('\n'),
)
// Der Import steht auch um `main` herum ganz oben, im Snippet in der ersten Zeile.
expect(plainLiveJava(doc0, labels, { asClass: false, withMain: true }).split('\n').slice(0, 3)).toEqual([
'import java.util.Scanner;',
'',
'public static void main(String[] args) {',
])
expect(plainLiveJava(doc0, labels).split('\n')[0]).toBe('import java.util.Scanner;')
// Klassenname tippen ändert den Titel …
expect(documentFromJava(doc0, parse('public class Taschenrechner {\n}')).caption).toBe('Taschenrechner')
// … aber aus „Mein Programm“ wird `Mein_Programm`, und der Titel bleibt.
expect(documentFromJava({ ...doc0, caption: 'Mein Programm' }, parse('public class Mein_Programm {\n}')).caption).toBe('Mein Programm')
// Klasse ohne main: Anweisungen direkt in der Klasse.
expect(parse('public class A {\n int x = 1;\n}').elements[0].textLines).toEqual(['int x = 1'])
})
it('Scanner ohne import ist ein Fehler, wie bei javac', () => {
const keys = (src: string) => parse(src).problems.map((p) => p.key)
expect(keys('Scanner scanner = new Scanner(System.in);\nint x = scanner.nextInt();')).toEqual(['web_parse_missing_import'])
expect(keys('import java.util.Scanner;\nScanner scanner = new Scanner(System.in);')).toEqual([])
expect(keys('import java.util.*;\npublic class A {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n }\n}')).toEqual([])
// Nur im Kommentar oder in einem Text zählt nicht.
expect(keys('// import java.util.Scanner;\nScanner s = new Scanner(System.in);')).toEqual(['web_parse_missing_import'])
expect(keys('System.out.println("Scanner");')).toEqual([])
})
it('\\n in einer Ausgabe beginnt eine neue Zeile; fehlende Zeilenumbrüche werden erkannt', () => {
const run = (src: string) => {
const engine = new SimulationEngine(doc(src))
let steps = 0
while (engine.canStep && steps++ < 1000) engine.step()
return engine.state.outputLines
}
const expected = ['Ludwig ist 7 Jahre alt.', 'Größe: 1.2 m']
expect(run('System.out.print("Ludwig ist 7 Jahre alt.\\n");\nSystem.out.print("Größe: 1.2 m");')).toEqual(expected)
expect(run('System.out.println("A\\nB");\nSystem.out.print("C");')).toEqual(['A', 'B', 'C'])
const joined = run('System.out.print("Ludwig ist 7 Jahre alt.");\nSystem.out.print("Größe: 1.2 m");')
expect(sameOutput(joined, expected)).toBe(false)
expect(onlyLineBreaksMissing(joined, expected)).toBe(true)
expect(onlyLineBreaksMissing(['Ludwig ist 7 Jahre alt. Größe: 1.3 m'], expected)).toBe(false)
expect(onlyLineBreaksMissing(expected, expected)).toBe(false)
})
it('System.out.print schreibt ohne neue Zeile, auch mit Array-Fach', () => {
const d = doc(
'int[] intAllgemeinFach = {3, 5};\n' +
'for (int i = 0; i < intAllgemeinFach.length; i++) {\n' +
' System.out.print(intAllgemeinFach[i] + ": ");\n' +
' System.out.println("ok");\n' +
'}\n' +
'System.out.print("A");\n' +
'System.out.print("B");\n' +
'System.out.println();',
)
const engine = new SimulationEngine(d)
let steps = 0
while (engine.canStep && steps++ < 1000) engine.step()
expect(engine.message).not.toMatch(/Nicht unterstützte|Unsupported/u)
expect(engine.state.outputLines).toEqual(['3: ok', '5: ok', 'AB'])
const java = generateCode(d, 'java')
expect(java).toContain('System.out.print(intAllgemeinFach[i] + ": ");')
expect(generateCode(d, 'javascript')).toContain('process.stdout.write(String(intAllgemeinFach[i] + ": "));')
expect(generateCode(d, 'python')).toContain('print(str(intAllgemeinFach[i]) + ": ", end="")')
})
it('Eingabe nach einer Ausgabe fragt nicht noch einmal nach dem Variablennamen', () => {
const ask = (src: string) => {
const engine = new SimulationEngine(doc(src))
while (engine.canStep && !engine.state.inputRequest) engine.step()
return { request: engine.state.inputRequest, lines: engine.state.outputLines }
}
const fach = 'String[] fach = {"Mathe"};\nint[] note = new int[1];\nint i = 0;\n'
expect(ask(fach + 'System.out.println("Note für Fach " + fach[i]);\nnote[i] = scanner.nextInt();')).toEqual({
request: { variableName: 'note[i]', valueType: 'int', prompt: '' },
lines: ['Note für Fach Mathe'],
})
expect(ask(fach + 'System.out.print(fach[i] + ": ");\nnote[i] = scanner.nextInt();')).toEqual({
request: { variableName: 'note[i]', valueType: 'int', prompt: '', continuesLine: true },
lines: ['Mathe: '],
})
// Ohne Ausgabe davor bleibt die Frage `name:`.
expect(ask(fach + 'note[i] = scanner.nextInt();').request?.prompt).toBe('note[i]:')
})
it('Arrays ohne import ist ein Fehler, wie bei javac', () => {
const keys = (src: string) => parse(src).problems.map((p) => p.key)
expect(keys('int[] a = {1, 2};\nSystem.out.println(Arrays.toString(a));')).toEqual(['web_parse_missing_import'])
expect(keys('import java.util.Arrays;\nint[] a = {1, 2};\nSystem.out.println(Arrays.toString(a));')).toEqual([])
expect(keys('int[] a = {1, 2};\nSystem.out.println(a);')).toEqual([])
})
it('Aufruf eines Unterprogramms aus einem anderen Reiter', () => {
expect(parse('int y = quadrat(4);', new Set(['quadrat'])).elements[0].type).toBe(ElementType.aufruf)
expect(parse('int y = quadrat(4);').elements[0].type).toBe(ElementType.anweisung)
})
it('klassisches switch mit break', () => {
const els = parse('switch (n) {\n case 1:\n x = 1;\n break;\n default:\n x = 0;\n}').elements
expect(els[0].cases?.map((c) => [c.name, c.elements.map((e) => e.textLines[0])])).toEqual([
['1', ['x = 1']],
['default', ['x = 0']],
])
})
it('unfertiger Code beim Tippen: Struktogramm entsteht trotzdem', () => {
// Nach `if (x > 0) {` ist die Verzweigung schon da.
const open = parse('if (x > 0) {')
expect(open.elements.map((e) => e.type)).toEqual([ElementType.verzweigung])
expect(open.problems.map((p) => p.arg)).toEqual(['}'])
// Fehlende `)` und fehlendes `;`.
const half = parse('if (x > 0 {\n System.out.println(x)\n}')
expect(half.elements[0].textLines).toEqual(['x > 0'])
expect(half.elements[0].cases![0].elements[0].textLines).toEqual(['output: x'])
expect(half.problems.map((p) => p.arg)).toEqual([')', ';'])
// Nur das Schlüsselwort.
expect(types('while')).toEqual([ElementType.whileSchleife])
expect(types('for (int i = 0; i <')).toEqual([ElementType.forSchleife])
// Offene Zeichenkette.
const str = parse('System.out.println("Hallo')
expect(str.elements).toHaveLength(1)
expect(str.problems.some((p) => p.key === 'web_parse_unclosed_string')).toBe(true)
// Zu viele Klammern.
expect(parse('x = 1;\n}').problems.map((p) => p.key)).toEqual(['web_parse_extra'])
})
it('Swing: Lambda und anonyme Klasse mit Rumpf sind eine Anweisung', () => {
const lambda = parse('knopf.addActionListener(e -> {\n knopf.setText("Ich wurde geklickt");\n});\nfenster.setVisible(true);')
expect(lambda.problems).toEqual([])
expect(lambda.elements.map((e) => e.textLines)).toEqual([
['knopf.addActionListener(e -> { knopf.setText("Ich wurde geklickt"); })'],
['fenster.setVisible(true)'],
])
const anonym = parse(
'knopf.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n knopf.setText("Ich wurde geklickt");\n }\n});',
)
expect(anonym.problems).toEqual([])
expect(anonym.elements).toHaveLength(1)
// Noch nicht fertig getippt: Die fehlende `}` wird gemeldet.
expect(parse('knopf.addActionListener(e -> {\n knopf.setText("x");').problems.map((p) => p.arg)).toContain('}')
})
it('try/catch/finally ist ein Anweisungskasten', () => {
const r = parse('try {\n int z = Integer.parseInt(text);\n} catch (NumberFormatException e) {\n System.out.println("Keine Zahl");\n} finally {\n fertig = true;\n}\nSystem.out.println("Weiter");')
expect(r.problems).toEqual([])
expect(r.elements.map((e) => e.textLines)).toEqual([
['try { int z = Integer.parseInt(text); } catch (NumberFormatException e) { System.out.println("Keine Zahl"); } finally { fertig = true; }'],
['output: "Weiter"'],
])
expect(parse('try {\n int z = 1;').problems.map((p) => p.arg)).toEqual(['}'])
})
it('Platzhalter wie „Bedingung“ gelten als leer und werden markiert', () => {
const src = 'if (Bedingung) {\n // Dein Code\n}'
const p = parse(src)
expect(p.elements[0].textLines).toEqual([''])
expect(p.placeholders.map((r) => src.slice(r.from, r.to))).toEqual(['Bedingung', '// Dein Code'])
expect(p.elements[0].cases![0].elements[0].textLines).toEqual(['ø'])
})
it('Zeilen der Elemente für die Markierung', () => {
const p = parse('int x = 1;\nwhile (x < 3) {\n x++;\n}')
expect(p.spans).toEqual([
{ path: [0], from: 0, to: 0 },
{ path: [1], from: 1, to: 3 },
{ path: [1, 0, 0], from: 2, to: 2 },
])
})
})
describe('Struktogramm ändern → getippter Code bleibt', () => {
const typed = [
'// Mein erstes Programm',
'int x = 1; // Startwert',
'',
'while (x < 10) {',
' // verdoppeln',
' x = x * 2;',
'}',
'System.out.println(x);',
].join('\n')
const before = doc(typed)
it('Text eines Kastens ändern: Kommentare bleiben', () => {
const after = setTextLines(before, [1, 0, 0], ['x = x * 3'])
expect(mergeLiveJava(typed, before, after, labels)).toBe(typed.replace('x = x * 2;', 'x = x * 3;'))
// Der Kommentar am Zeilenende wandert mit.
const start = setTextLines(before, [0], ['int x = 2'])
expect(mergeLiveJava(typed, before, start, labels)).toBe(typed.replace('int x = 1;', 'int x = 2;'))
})
it('Element einfügen und löschen', () => {
const added = insertAfterSibling(before, makeElement(ElementType.anweisung, { textLines: ['output: "fertig"'] }), [2])
expect(mergeLiveJava(typed, before, added, labels)).toBe(typed + '\nSystem.out.println("fertig");')
const removed: VSDocument = { ...before, elements: before.elements.slice(0, 2) }
expect(mergeLiveJava(typed, before, removed, labels)).toBe(typed.split('\n').slice(0, -1).join('\n'))
})
it('unveränderter erzeugter Code wird einfach neu erzeugt', () => {
const code = plainLiveJava(before, labels)
const after = setTextLines(before, [0], ['int x = 3'])
expect(mergeLiveJava(code, before, after, labels)).toBe(plainLiveJava(after, labels))
})
it('Farben der Kästen bleiben beim Tippen erhalten', () => {
const colored: VSDocument = { ...before, elements: before.elements.map((e, i) => (i === 1 ? { ...e, backgroundColor: { r: 1, g: 0, b: 0, a: 1 } } : e)) }
const next = documentFromJava(colored, parse(typed.replace('x < 10', 'x < 20')))
expect(next.elements[1].backgroundColor).toEqual({ r: 1, g: 0, b: 0, a: 1 })
expect(next.elements[1].textLines).toEqual(['x < 20'])
})
})
describe('Scanner ohne Variable', () => {
const L = { code: 'Dein Code' } as Parameters<typeof parseLiveJava>[1]
const main = (body: string) => `import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n${body}\n }\n}`
const keys = (src: string) => parseLiveJava(src, L).problems.filter((p) => p.key === 'web_parse_missing_scanner').map((p) => [p.key, p.arg])
it('meldet eingabe.next() ohne angelegten Scanner', () => {
expect(keys(main(' String s = eingabe.next();'))).toEqual([['web_parse_missing_scanner', 'Scanner eingabe = new Scanner(System.in);']])
})
it('nimmt angelegte Scanner, Attribute und Parameter an', () => {
expect(keys(main(' Scanner eingabe = new Scanner(System.in);\n String s = eingabe.next();\n while (eingabe.hasNextInt()) eingabe.nextInt();'))).toEqual([])
expect(keys(`import java.util.Scanner;\n\npublic class Main {\n static Scanner sc = new Scanner(System.in);\n\n static int lies(Scanner in) {\n return in.nextInt();\n }\n\n public static void main(String[] args) {\n String s = sc.nextLine();\n }\n}`)).toEqual([])
})
})
describe('boolean und vertippte Datentypen', () => {
const typo = (src: string) => parse(src).problems.find((p) => p.key === 'web_parse_unknown_type')?.arg
it('meldet vertippte Grundtypen mit Vorschlag', () => {
expect(typo('booelan wpfAlleUeber5;')).toBe('boolean')
expect(typo('Int x = 3;')).toBe('int')
expect(typo('string s = "a";')).toBe('String')
expect(typo('dobule d = 2;')).toBe('double')
expect(typo('for (Int i = 0; i < 3; i++) {\n}')).toBe('int')
})
it('lässt gültige Typen und eigene Klassen in Ruhe', () => {
for (const src of ['boolean b = true;', 'Boolean b = true;', 'Integer i = 3;', 'Kind k = new Kind();', 'Auto a;', 'String s;', 'return x;'])
expect(typo(src)).toBeUndefined()
})
it('simuliert boolean ohne Startwert, Vergleiche und Ausgaben von Bedingungen', () => {
const src = 'boolean fertig;\nint x = 3;\nSystem.out.println(fertig);\nfertig = x < 5;\nif (fertig == true) {\n System.out.println("ja " + fertig);\n}\nSystem.out.println(!fertig);\nSystem.out.println(x + 1 > 3);\nSystem.out.println("klein: " + (x < 3));\nint a, b;\nSystem.out.println(a + b);'
const engine = new SimulationEngine(doc(src))
let steps = 0
while (engine.canStep && steps++ < 1000) engine.step()
expect(engine.state.outputLines).toEqual(['false', 'ja true', 'false', 'true', 'klein: false', '0'])
})
})
describe('Groß- und Kleinschreibung', () => {
const wrongCase = (src: string) => parse(src).problems.find((p) => p.key === 'web_parse_wrong_case')?.arg
it('meldet falsch geschriebene Java-Wörter mit der richtigen Schreibweise', () => {
expect(wrongCase('system.out.println(1);')).toBe('System')
expect(wrongCase('System.Out.println(1);')).toBe('out')
expect(wrongCase('System.out.Println(1);')).toBe('println')
expect(wrongCase('double w = math.sqrt(4);')).toBe('Math')
expect(wrongCase('int[] a = {1};\nint n = a.Length;')).toBe('length')
expect(wrongCase('String s = "a";\nchar c = s.charat(0);')).toBe('charAt')
})
it('lässt richtige Schreibweise und eigene Variablen in Ruhe', () => {
for (const src of ['System.out.println(1);', 'String string = "a";\nint n = string.length();', 'int zahl = 1;\nint Zahl = 2;\nSystem.out.println(zahl + Zahl);'])
expect(wrongCase(src)).toBeUndefined()
})
it('die Simulation nennt bei einer unbekannten Variable den Namen in anderer Schreibweise', () => {
const engine = new SimulationEngine(doc('int zahl = 4;\nSystem.out.println(Zahl);'))
let steps = 0
while (engine.canStep && steps++ < 100) engine.step()
expect(engine.state.notice).toEqual({ kind: 'unknownVariable', text: 'Zahl', similar: 'zahl' })
})
})