2010-04-30 11:14:12 +0900 (5321d); rev 2
xyzzy上での単体テストを支援するライブラリです。Gaucheのテストモジュールgauche.testを参考に作られています。
ソースファイル中にコメントとして書かれていますが、あわせて[gauche-ref-ja:gauche.test]のドキュメントも 参照するとよいでしょう。
なおサンプルを実行すると*test*バッファが開かれて次のような出力がなされます。
Testing mylib ... <Section 1>-------------------------------------------------------------------- test test-1.0, expects (0) ==> ok test test-1.1, expects (0) ==> ERROR: GOT (0) test test-1.2, expects (0) ==> ok <Section 2>-------------------------------------------------------------------- test test-2.0, expects #S(test::test-error mes nil) ==> ok test test-2.1, expects 0 ==> ERROR: GOT #S(test::test-error mes #S(division-by-zero operation / operands (1 0))) test test-2.2, expects 0 ==> >CALL STACK 16: (/ 1 0) >CALL STACK 15: (#<lexical-closure: (anonymous)>) >CALL STACK 14: (system:*byte-code ...) >CALL STACK 13: (#<lexical-closure: (anonymous)>) >CALL STACK 12: (system:*byte-code ...) >CALL STACK 11: (#<lexical-closure: prim-test> "test-2.2" 0 #<lexical-closure: (anonymous)> nil) >CALL STACK 10: (system:*byte-code ...) >CALL STACK 9: (test "test-2.2" 0 #<lexical-closure: (anonymous)>) >CALL STACK 8: (test* ("test-2.2" 0 (/ 1 0))) >CALL STACK 7: (#<function: *load-library> "test-foo") >CALL STACK 6: (apply #<function: *load-library> "test-foo" nil) >CALL STACK 5: (system:*byte-code ...) >CALL STACK 4: (load-library "test-foo") >CALL STACK 3: (system:*byte-code ...) >CALL STACK 2: (#<lexical-closure: run-test>) >CALL STACK 1: (command-execute run-test) 0で除算しました: /: (1 0) ERROR: GOT #S(test::test-error mes #S(division-by-zero operation / operands (1 0))) failed. discrepancies found. Errors are: test test-1.1: expects (0) => got (0) test test-2.1: expects 0 => got #S(test::test-error mes #S(division-by-zero operation / operands (1 0))) test test-2.2: expects 0 => got #S(test::test-error mes #S(division-by-zero operation / operands (1 0)))
Related Pages: FrontPage