1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-30 00:40:20 +02:00

test suite: Use `pass-if-equal' in texinfo.test.

* test-suite/tests/texinfo.test: Replace occurrences of
  `(pass-if (equal? ...))' by `pass-if-equal'.
This commit is contained in:
Ludovic Courtès 2013-03-21 16:36:24 +01:00
parent 14ae4725ab
commit c52ce75a1f

View file

@ -1,6 +1,6 @@
;;;; texinfo.test -*- scheme -*- ;;;; texinfo.test -*- scheme -*-
;;;; ;;;;
;;;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. ;;;; Copyright (C) 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
;;;; Copyright (C) 2001,2002 Oleg Kiselyov <oleg at pobox dot com> ;;;; Copyright (C) 2001,2002 Oleg Kiselyov <oleg at pobox dot com>
;;;; ;;;;
;;;; This library is free software; you can redistribute it and/or ;;;; This library is free software; you can redistribute it and/or
@ -56,24 +56,24 @@
str str
(lambda (port) (texinfo:read-verbatim-body port consumer '()))))) (lambda (port) (texinfo:read-verbatim-body port consumer '())))))
(pass-if (equal? '() (pass-if-equal '()
(read-verbatim-body-from-string "@end verbatim\n"))) (read-verbatim-body-from-string "@end verbatim\n"))
;; after @verbatim, the current position will always directly after ;; after @verbatim, the current position will always directly after
;; the newline. ;; the newline.
(pass-if-exception "@end verbatim needs a newline" (pass-if-exception "@end verbatim needs a newline"
exception:eof-while-reading-token exception:eof-while-reading-token
(read-verbatim-body-from-string "@end verbatim")) (read-verbatim-body-from-string "@end verbatim"))
(pass-if (equal? '("@@end verbatim" " NL\n")
(read-verbatim-body-from-string "@@end verbatim\n@end verbatim\n")))
(pass-if (equal? '("@@@@faosfasf adsfas " " NL\n" " asf @foo{asdf}" " NL\n") (pass-if-equal '("@@end verbatim" " NL\n")
(read-verbatim-body-from-string (read-verbatim-body-from-string "@@end verbatim\n@end verbatim\n"))
"@@@@faosfasf adsfas \n asf @foo{asdf}\n@end verbatim\n")))
(pass-if (equal? '("@end verbatim " " NL\n") (pass-if-equal '("@@@@faosfasf adsfas " " NL\n" " asf @foo{asdf}" " NL\n")
(read-verbatim-body-from-string "@end verbatim \n@end verbatim\n")))) (read-verbatim-body-from-string
"@@@@faosfasf adsfas \n asf @foo{asdf}\n@end verbatim\n"))
(pass-if-equal '("@end verbatim " " NL\n")
(read-verbatim-body-from-string "@end verbatim \n@end verbatim\n")))
(define texinfo:read-arguments (define texinfo:read-arguments
(@@ (texinfo) read-arguments)) (@@ (texinfo) read-arguments))
@ -84,8 +84,8 @@
(lambda (port) (texinfo:read-arguments port #\})))) (lambda (port) (texinfo:read-arguments port #\}))))
(define (test str expected-res) (define (test str expected-res)
(pass-if (equal? expected-res (pass-if-equal expected-res
(read-arguments-from-string str)))) (read-arguments-from-string str)))
(test "}" '()) (test "}" '())
(test "foo}" '("foo")) (test "foo}" '("foo"))
@ -111,20 +111,20 @@
(texinfo:complete-start-command command port)) (texinfo:complete-start-command command port))
list)))) list))))
(pass-if (equal? '(section () EOL-TEXT) (pass-if-equal '(section () EOL-TEXT)
(test 'section "foo bar baz bonzerts"))) (test 'section "foo bar baz bonzerts"))
(pass-if (equal? '(deffnx ((category "Function") (name "foo") (arguments)) EOL-TEXT-ARGS) (pass-if-equal '(deffnx ((category "Function") (name "foo") (arguments)) EOL-TEXT-ARGS)
(test 'deffnx "Function foo"))) (test 'deffnx "Function foo"))
(pass-if-exception "@emph missing a start brace" (pass-if-exception "@emph missing a start brace"
exception:wrong-character exception:wrong-character
(test 'emph "no brace here")) (test 'emph "no brace here"))
(pass-if (equal? '(emph () INLINE-TEXT) (pass-if-equal '(emph () INLINE-TEXT)
(test 'emph "{foo bar baz bonzerts"))) (test 'emph "{foo bar baz bonzerts"))
(pass-if (equal? '(ref ((node "foo bar") (section "baz") (info-file "bonzerts")) (pass-if-equal '(ref ((node "foo bar") (section "baz") (info-file "bonzerts"))
INLINE-ARGS) INLINE-ARGS)
(test 'ref "{ foo bar ,, baz, bonzerts}"))) (test 'ref "{ foo bar ,, baz, bonzerts}"))
(pass-if (equal? '(node ((name "referenced node")) EOL-ARGS) (pass-if-equal '(node ((name "referenced node")) EOL-ARGS)
(test 'node " referenced node\n")))) (test 'node " referenced node\n")))
(define texinfo:read-char-data (define texinfo:read-char-data
(@@ (texinfo) read-char-data)) (@@ (texinfo) read-char-data))
@ -149,8 +149,8 @@
port expect-eof? preserve-ws? str-handler '())))) port expect-eof? preserve-ws? str-handler '()))))
(lambda (seed token) (lambda (seed token)
(let ((result (reverse seed))) (let ((result (reverse seed)))
(pass-if (equal? expected-data result)) (pass-if-equal expected-data result)
(pass-if (equal? expected-token token)))))) (pass-if-equal expected-token token)))))
;; add some newline-related tests here ;; add some newline-related tests here
(test "" #t #f '() eof-object) (test "" #t #f '() eof-object)
@ -167,8 +167,8 @@
(with-test-prefix "test-texinfo->stexinfo" (with-test-prefix "test-texinfo->stexinfo"
(define (test str expected-res) (define (test str expected-res)
(pass-if (equal? expected-res (pass-if-equal expected-res
(call-with-input-string str texi->stexi)))) (call-with-input-string str texi->stexi)))
(define (try-with-title title str) (define (try-with-title title str)
(call-with-input-string (call-with-input-string
(string-append "foo bar baz\n@settitle " title "\n" str) (string-append "foo bar baz\n@settitle " title "\n" str)
@ -177,9 +177,8 @@
(test (string-append "foo bar baz\n@settitle " title "\n" str) (test (string-append "foo bar baz\n@settitle " title "\n" str)
expected-res)) expected-res))
(define (test-body str expected-res) (define (test-body str expected-res)
(pass-if str (pass-if-equal str expected-res
(equal? expected-res (cddr (try-with-title "zog" str))))
(cddr (try-with-title "zog" str)))))
(define (list-intersperse src-l elem) (define (list-intersperse src-l elem)
(if (null? src-l) src-l (if (null? src-l) src-l