mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
In ports.test, convert some pass-if tests to pass-if-equal
* test-suite/tests/ports.test ("line counter"): convert several tests to use pass-if-equal
This commit is contained in:
parent
50371bc6ed
commit
1838ef8ef6
1 changed files with 18 additions and 18 deletions
|
@ -1179,30 +1179,30 @@
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (port port-name)
|
(lambda (port port-name)
|
||||||
(with-test-prefix port-name
|
(with-test-prefix port-name
|
||||||
(pass-if "at beginning of input"
|
(pass-if-equal "at beginning of input"
|
||||||
(= (port-line port) 0))
|
0 (port-line port))
|
||||||
(pass-if "read first character"
|
(pass-if-equal "read first character"
|
||||||
(eqv? (read-char port) #\x))
|
#\x (read-char port))
|
||||||
(pass-if "after reading one character"
|
(pass-if-equal "after reading one character"
|
||||||
(= (port-line port) 0))
|
0 (port-line port))
|
||||||
(pass-if "read first newline"
|
(pass-if-equal "read first newline"
|
||||||
(eqv? (read-char port) #\newline))
|
#\newline (read-char port))
|
||||||
(pass-if "after reading first newline char"
|
(pass-if-equal "after reading first newline char"
|
||||||
(= (port-line port) 1))
|
1 (port-line port))
|
||||||
(pass-if "second line read correctly"
|
(pass-if-equal "second line read correctly"
|
||||||
(equal? (read-line port) second-line))
|
second-line (read-line port))
|
||||||
(pass-if "read-line increments line number"
|
(pass-if-equal "read-line increments line number"
|
||||||
(= (port-line port) 2))
|
2 (port-line port))
|
||||||
(pass-if "read-line returns EOF"
|
(pass-if "read-line returns EOF"
|
||||||
(let loop ((i 0))
|
(let loop ((i 0))
|
||||||
(cond
|
(cond
|
||||||
((eof-object? (read-line port)) #t)
|
((eof-object? (read-line port)) #t)
|
||||||
((> i 20) #f)
|
((> i 20) #f)
|
||||||
(else (loop (+ i 1))))))
|
(else (loop (+ i 1))))))
|
||||||
(pass-if "line count is 5 at EOF"
|
(pass-if-equal "line count is 5 at EOF"
|
||||||
(= (port-line port) 5))
|
5 (port-line port))
|
||||||
(pass-if "column is correct at EOF"
|
(pass-if-equal "column is correct at EOF"
|
||||||
(= (port-column port) final-column))))
|
final-column (port-column port))))
|
||||||
ports port-list-names)
|
ports port-list-names)
|
||||||
(for-each close-port ports)
|
(for-each close-port ports)
|
||||||
(delete-file port-loop-temp))))
|
(delete-file port-loop-temp))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue