File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ SHUSH(0d1)
Original file line number Diff line number Diff line change 1+ UNSHUSH(0d1)
Original file line number Diff line number Diff line change 1+ $helperPath = Join-Path (Split-Path - Parent (Split-Path - Parent $PSScriptRoot )) ' helpers\prefix-input.ps1'
2+ . $helperPath
3+
4+ $tempDir = New-PrefixTempDir
5+
6+ try {
7+ $programPath = Join-Path $tempDir ' program.pre'
8+
9+ Set-Content - Path $programPath - Encoding Ascii - Value @'
10+ SHUSH()
11+ ASSERT(EQ(CL("echo prefix-shush-cl"), 0d0))
12+ '@
13+
14+ $startInfo = New-Object System.Diagnostics.ProcessStartInfo
15+ $startInfo.FileName = Get-PrefixExePath
16+ $startInfo.Arguments = (' "{0}"' -f $programPath )
17+ $startInfo.RedirectStandardOutput = $true
18+ $startInfo.RedirectStandardError = $true
19+ $startInfo.UseShellExecute = $false
20+ $startInfo.CreateNoWindow = $true
21+
22+ $process = [System.Diagnostics.Process ]::Start($startInfo )
23+ try {
24+ $stdout = $process.StandardOutput.ReadToEnd ()
25+ $stderr = $process.StandardError.ReadToEnd ()
26+ $process.WaitForExit ()
27+
28+ $result = [pscustomobject ]@ {
29+ ExitCode = $process.ExitCode
30+ Stdout = $stdout
31+ Stderr = $stderr
32+ }
33+ }
34+ finally {
35+ $process.Dispose ()
36+ }
37+
38+ Assert-PrefixSuccess $result
39+ Assert-NoErrorOutput $result
40+
41+ if ($result.Stdout.Length -ne 0 ) {
42+ $stdout = Format-VisibleText $result.Stdout
43+ throw " Expected no stdout output, got: $stdout "
44+ }
45+ }
46+ finally {
47+ Remove-Item - Path $tempDir - Recurse - Force - ErrorAction SilentlyContinue
48+ }
Original file line number Diff line number Diff line change 1+ $helperPath = Join-Path (Split-Path - Parent (Split-Path - Parent $PSScriptRoot )) ' helpers\prefix-input.ps1'
2+ . $helperPath
3+
4+ $tempDir = New-PrefixTempDir
5+
6+ try {
7+ $programPath = Join-Path $tempDir ' program.pre'
8+
9+ Set-Content - Path $programPath - Encoding Ascii - Value @'
10+ SHUSH()
11+ STR: line = INPUT("PROMPT>")
12+ ASSERT(EQ(line, "alpha"))
13+ PRINT("hidden")
14+ '@
15+
16+ $result = Invoke-PrefixProgramWithInput - ProgramPath $programPath - InputText " alpha`r`n "
17+
18+ Assert-PrefixSuccess $result
19+ Assert-NoErrorOutput $result
20+
21+ if (-not [regex ]::IsMatch($result.Stdout , ' \APROMPT>\z' )) {
22+ $stdout = Format-VisibleText $result.Stdout
23+ throw " Unexpected stdout: $stdout "
24+ }
25+ }
26+ finally {
27+ Remove-Item - Path $tempDir - Recurse - Force - ErrorAction SilentlyContinue
28+ }
Original file line number Diff line number Diff line change 1+ $helperPath = Join-Path (Split-Path - Parent (Split-Path - Parent $PSScriptRoot )) ' helpers\prefix-input.ps1'
2+ . $helperPath
3+
4+ $tempDir = New-PrefixTempDir
5+
6+ try {
7+ $programPath = Join-Path $tempDir ' program.pre'
8+
9+ Set-Content - Path $programPath - Encoding Ascii - Value @'
10+ SHUSH()
11+ PRINT("hidden")
12+ '@
13+
14+ $startInfo = New-Object System.Diagnostics.ProcessStartInfo
15+ $startInfo.FileName = Get-PrefixExePath
16+ $startInfo.Arguments = (' "{0}"' -f $programPath )
17+ $startInfo.RedirectStandardOutput = $true
18+ $startInfo.RedirectStandardError = $true
19+ $startInfo.UseShellExecute = $false
20+ $startInfo.CreateNoWindow = $true
21+
22+ $process = [System.Diagnostics.Process ]::Start($startInfo )
23+ try {
24+ $stdout = $process.StandardOutput.ReadToEnd ()
25+ $stderr = $process.StandardError.ReadToEnd ()
26+ $process.WaitForExit ()
27+
28+ $result = [pscustomobject ]@ {
29+ ExitCode = $process.ExitCode
30+ Stdout = $stdout
31+ Stderr = $stderr
32+ }
33+ }
34+ finally {
35+ $process.Dispose ()
36+ }
37+
38+ Assert-PrefixSuccess $result
39+ Assert-NoErrorOutput $result
40+
41+ if ($result.Stdout.Length -ne 0 ) {
42+ $stdout = Format-VisibleText $result.Stdout
43+ throw " Expected no stdout output, got: $stdout "
44+ }
45+ }
46+ finally {
47+ Remove-Item - Path $tempDir - Recurse - Force - ErrorAction SilentlyContinue
48+ }
Original file line number Diff line number Diff line change 1+ ASSERT(EQ(SHUSH(), FALSE))
Original file line number Diff line number Diff line change 1+ $helperPath = Join-Path (Split-Path - Parent (Split-Path - Parent $PSScriptRoot )) ' helpers\prefix-input.ps1'
2+ . $helperPath
3+
4+ $tempDir = New-PrefixTempDir
5+
6+ try {
7+ $programPath = Join-Path $tempDir ' program.pre'
8+
9+ Set-Content - Path $programPath - Encoding Ascii - Value @'
10+ SHUSH()
11+ WARN("hidden")
12+ '@
13+
14+ $startInfo = New-Object System.Diagnostics.ProcessStartInfo
15+ $startInfo.FileName = Get-PrefixExePath
16+ $startInfo.Arguments = (' -verbose "{0}"' -f $programPath )
17+ $startInfo.RedirectStandardOutput = $true
18+ $startInfo.RedirectStandardError = $true
19+ $startInfo.UseShellExecute = $false
20+ $startInfo.CreateNoWindow = $true
21+
22+ $process = [System.Diagnostics.Process ]::Start($startInfo )
23+ try {
24+ $stdout = $process.StandardOutput.ReadToEnd ()
25+ $stderr = $process.StandardError.ReadToEnd ()
26+ $process.WaitForExit ()
27+
28+ $result = [pscustomobject ]@ {
29+ ExitCode = $process.ExitCode
30+ Stdout = $stdout
31+ Stderr = $stderr
32+ }
33+ }
34+ finally {
35+ $process.Dispose ()
36+ }
37+
38+ Assert-PrefixSuccess $result
39+ Assert-NoErrorOutput $result
40+
41+ if ($result.Stdout.Length -ne 0 ) {
42+ $stdout = Format-VisibleText $result.Stdout
43+ throw " Expected no stdout output, got: $stdout "
44+ }
45+ }
46+ finally {
47+ Remove-Item - Path $tempDir - Recurse - Force - ErrorAction SilentlyContinue
48+ }
Original file line number Diff line number Diff line change 1+ ASSERT(EQ(UNSHUSH(), FALSE))
Original file line number Diff line number Diff line change 1+ $helperPath = Join-Path (Split-Path - Parent (Split-Path - Parent $PSScriptRoot )) ' helpers\prefix-input.ps1'
2+ . $helperPath
3+
4+ $tempDir = New-PrefixTempDir
5+
6+ try {
7+ $programPath = Join-Path $tempDir ' program.pre'
8+
9+ Set-Content - Path $programPath - Encoding Ascii - Value @'
10+ SHUSH()
11+ PRINT("hidden")
12+ ASSERT(EQ(UNSHUSH(), FALSE))
13+ PRINT("shown")
14+ '@
15+
16+ $startInfo = New-Object System.Diagnostics.ProcessStartInfo
17+ $startInfo.FileName = Get-PrefixExePath
18+ $startInfo.Arguments = (' "{0}"' -f $programPath )
19+ $startInfo.RedirectStandardOutput = $true
20+ $startInfo.RedirectStandardError = $true
21+ $startInfo.UseShellExecute = $false
22+ $startInfo.CreateNoWindow = $true
23+
24+ $process = [System.Diagnostics.Process ]::Start($startInfo )
25+ try {
26+ $stdout = $process.StandardOutput.ReadToEnd ()
27+ $stderr = $process.StandardError.ReadToEnd ()
28+ $process.WaitForExit ()
29+
30+ $result = [pscustomobject ]@ {
31+ ExitCode = $process.ExitCode
32+ Stdout = $stdout
33+ Stderr = $stderr
34+ }
35+ }
36+ finally {
37+ $process.Dispose ()
38+ }
39+
40+ Assert-PrefixSuccess $result
41+ Assert-NoErrorOutput $result
42+
43+ if (-not [regex ]::IsMatch($result.Stdout , ' \Ashown(?:\r\n|\n)\z' )) {
44+ $stdout = Format-VisibleText $result.Stdout
45+ throw " Unexpected stdout: $stdout "
46+ }
47+ }
48+ finally {
49+ Remove-Item - Path $tempDir - Recurse - Force - ErrorAction SilentlyContinue
50+ }
Original file line number Diff line number Diff line change 1+ SHUSH()
2+ ASSERT(EQ(UNSHUSH(), FALSE))
You can’t perform that action at this time.
0 commit comments