Read
Read a byte
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “A”.
Read bytes
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “ABC”.
Peek a byte
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “A”.
Peek a byte multiple times
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “AA”.
Peek and read bytes
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “AAB”.
Read a character
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “A”.
Peek a character
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “A”.
Peek a character multiple times
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “AA”.
Peek and read characters
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “AAB”.
Read a value
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “A”.
Examples
value |
---|
#f |
#t |
0 |
1 |
2 |
42 |
-1 |
-2 |
-42 |
a |
x |
foo |
#\A |
#\newline |
"" |
"foo" |
"Hello, world!" |
"\n\r\t” |
() |
(1) |
(1 2) |
(1 2 3) |
(1 . 2) |
(1 2 . 3) |
(foo) |
(foo bar) |
(foo bar baz) |
(foo . bar) |
(foo bar . baz) |
#(foo) |
#(foo bar) |
#(foo bar baz) |
#u8() |
#u8(1) |
#u8(1 2) |
#u8(1 2 3) |
Read from a port
Given a file named “main.scm” with:
And a file named “input.txt” with:
When I run scheme main.scm
interactively
And I pipe in the file “input.txt”
Then the exit status should be 0
And the stdout should contain exactly “A”.