Skip to content

Commit f7274b1

Browse files
Update test format (closes #236)
1 parent 8df4284 commit f7274b1

1,438 files changed

Lines changed: 12462 additions & 7630 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎tests/cases/cli/repl.yaml‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
passing:
2+
- name: repl-basic
3+
language: PowerShell
4+
source: |
5+
$helperPath = Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) 'helpers\prefix-input.ps1'
6+
. $helperPath
7+
8+
$result = Invoke-PrefixWithArguments -Arguments @() -InputText "PRINT('repl-basic')`n.exit`n"
9+
10+
Assert-PrefixSuccess $result
11+
Assert-NoErrorOutput $result
12+
13+
$stdout = Format-VisibleText $result.Stdout
14+
if (-not ($stdout -match 'repl-basic')) {
15+
throw "Unexpected stdout: $stdout"
16+
}
17+
18+
- name: repl-eof
19+
language: PowerShell
20+
source: |
21+
$helperPath = Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) 'helpers\prefix-input.ps1'
22+
. $helperPath
23+
24+
# Send a single command and EOF (no explicit .exit)
25+
$result = Invoke-PrefixWithArguments -Arguments @() -InputText "PRINT('bye')`n"
26+
27+
Assert-PrefixSuccess $result
28+
Assert-NoErrorOutput $result
29+
30+
$stdout = Format-VisibleText $result.Stdout
31+
if (-not ($stdout -match 'bye')) {
32+
throw "Unexpected stdout: $stdout"
33+
}
34+
35+
- name: repl-multiline
36+
language: PowerShell
37+
source: |
38+
$helperPath = Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) 'helpers\prefix-input.ps1'
39+
. $helperPath
40+
41+
$input = @'
42+
FUNC STR hello(){
43+
RETURN("hi")
44+
}
45+
PRINT(hello())
46+
.exit
47+
'@
48+
49+
$result = Invoke-PrefixWithArguments -Arguments @() -InputText $input
50+
51+
Assert-PrefixSuccess $result
52+
Assert-NoErrorOutput $result
53+
54+
$stdout = Format-VisibleText $result.Stdout
55+
if (-not ($stdout -match 'hi')) {
56+
throw "Unexpected stdout: $stdout"
57+
}
58+
59+
- name: repl-persistence
60+
language: PowerShell
61+
source: |
62+
$helperPath = Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) 'helpers\prefix-input.ps1'
63+
. $helperPath
64+
65+
$input = @'
66+
BOOL persisted = TRUE
67+
68+
PRINT(persisted)
69+
.exit
70+
'@
71+
72+
$result = Invoke-PrefixWithArguments -Arguments @() -InputText $input
73+
74+
Assert-PrefixSuccess $result
75+
Assert-NoErrorOutput $result
76+
77+
$stdout = Format-VisibleText $result.Stdout
78+
if (-not ($stdout -match 'TRUE')) {
79+
throw "Unexpected stdout: $stdout"
80+
}
81+

‎tests/cases/cli/traceback.yaml‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
passing:
2+
- name: traceback-private-overrides-verbose
3+
language: PowerShell
4+
source: |
5+
$helperPath = Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) 'helpers\prefix-input.ps1'
6+
. $helperPath
7+
8+
$tempDir = New-PrefixTempDir
9+
try {
10+
$programPath = Join-Path $tempDir 'program.pre'
11+
12+
Set-Content -Path $programPath -Encoding Ascii -Value @'
13+
FREEZE("not_declared")
14+
'@
15+
16+
# Pass both -verbose and -private; private should suppress snapshots
17+
$result = Invoke-PrefixWithArguments -Arguments @('-verbose', '-private', $programPath)
18+
19+
if ($result.ExitCode -eq 0) {
20+
$stdout = Format-VisibleText $result.Stdout
21+
$stderr = Format-VisibleText $result.Stderr
22+
throw "Expected interpreter to exit nonzero; got 0. STDOUT: $stdout STDERR: $stderr"
23+
}
24+
25+
if (-not ($result.Stderr -match 'Traceback')) {
26+
$stderr = Format-VisibleText $result.Stderr
27+
throw "Expected 'Traceback' in stderr: $stderr"
28+
}
29+
30+
if ($result.Stderr -match 'State log index') {
31+
$stderr = Format-VisibleText $result.Stderr
32+
throw "Unexpected state log when -private present: $stderr"
33+
}
34+
35+
if ($result.Stderr -match 'Env snapshot') {
36+
$stderr = Format-VisibleText $result.Stderr
37+
throw "Unexpected env snapshot when -private present: $stderr"
38+
}
39+
}
40+
finally {
41+
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
42+
}
43+
44+
- name: traceback-private-suppresses-snapshots
45+
language: PowerShell
46+
source: |
47+
$helperPath = Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) 'helpers\prefix-input.ps1'
48+
. $helperPath
49+
50+
$tempDir = New-PrefixTempDir
51+
try {
52+
$programPath = Join-Path $tempDir 'program.pre'
53+
54+
Set-Content -Path $programPath -Encoding Ascii -Value @'
55+
FREEZE("not_declared")
56+
'@
57+
58+
$result = Invoke-PrefixWithArguments -Arguments @('-private', $programPath)
59+
60+
if ($result.ExitCode -eq 0) {
61+
$stdout = Format-VisibleText $result.Stdout
62+
$stderr = Format-VisibleText $result.Stderr
63+
throw "Expected interpreter to exit nonzero; got 0. STDOUT: $stdout STDERR: $stderr"
64+
}
65+
66+
if (-not ($result.Stderr -match 'Traceback')) {
67+
$stderr = Format-VisibleText $result.Stderr
68+
throw "Expected 'Traceback' in stderr: $stderr"
69+
}
70+
71+
if (-not ($result.Stderr -match 'RuntimeError')) {
72+
$stderr = Format-VisibleText $result.Stderr
73+
throw "Expected 'RuntimeError' in stderr: $stderr"
74+
}
75+
76+
if ($result.Stderr -match 'State log index') {
77+
$stderr = Format-VisibleText $result.Stderr
78+
throw "Unexpected state log in private mode: $stderr"
79+
}
80+
81+
if ($result.Stderr -match 'Env snapshot') {
82+
$stderr = Format-VisibleText $result.Stderr
83+
throw "Unexpected env snapshot in private mode: $stderr"
84+
}
85+
}
86+
finally {
87+
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
88+
}
89+

‎tests/cases/failing/abs-type-bool.pre‎

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

‎tests/cases/failing/abs-type-str.pre‎

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

‎tests/cases/failing/add-mixed-types.pre‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎tests/cases/failing/alias-cycle.pre‎

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

‎tests/cases/failing/alias-to-frozen.pre‎

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

‎tests/cases/failing/all-arity-zero.pre‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎tests/cases/failing/and-arity-three.pre‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎tests/cases/failing/and-arity-zero.pre‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)