1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
(define-module (tests serializers ini-test)
#:use-module (srfi srfi-64)
;; #:use-module (tests runner)
)
;; https://rednosehacker.com/hall-a-project-manager-for-the-guile-programming-language
(module-define! (resolve-module '(srfi srfi-64))
'test-log-to-file #f)
(use-modules (ice-9 pretty-print))
(define (test-runner-ok)
(let ((runner (test-runner-null)))
(test-runner-on-group-begin! runner
(lambda (runner name count)
(format #t "Test group: ~a\n\n" name)))
(test-runner-on-test-end! runner
(lambda (runner)
(format #t "[~a] ~a\n"
(test-result-ref runner 'result-kind)
(if (test-result-ref runner 'test-name)
(test-runner-test-name runner)
"<>"))
(case (test-result-kind runner)
((fail xfail)
(if (test-result-ref runner 'expected-value)
(format #t "~a:~a\n -> expected: ~s\n -> obtained: ~s\n\n"
(test-result-ref runner 'source-file)
(test-result-ref runner 'source-line)
(test-result-ref runner 'expected-value)
(test-result-ref runner 'actual-value))))
(else #t))))
(test-runner-on-final! runner
(lambda (runner)
(format #t "Source: ~a\npass = ~a, fail = ~a\n\n"
(test-result-ref runner 'source-file)
(test-runner-pass-count runner)
(test-runner-fail-count runner))))
runner))
(test-runner-factory test-runner-ok)
;; (test-runner-factory test-runner-simple)
;; https://www.mail-archive.com/geiser-users%40nongnu.org/msg00323.html
;; https://rednosehacker.com/revisiting-guile-xunit
;; Test runners:
;; https://github.com/aconchillo/guile-json/blob/master/tests/runner.scm
;; https://luis-felipe.gitlab.io/guile-proba/
;; https://git.systemreboot.net/run64/tree/bin/run64
(let ((%test-name "Object to string"))
(test-begin %test-name)
(test-equal "case1" "12345" (object->string 12345))
(test-equal "12345" (object->string 12345))
(test-equal "case2" "12346" (object->string 12345))
(test-equal "case3" "12346" (object->string 12345))
(test-end %test-name))
;; (let ((%test-name "Number ato string"))
;; (test-begin %test-name)
;; (test-equal "12345" (number->string 12345))
;; (test-equal "12346" (number->string 12345))
;; (test-equal "12346" (number->string 12345))
;; (test-end %test-name))