Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sperate code to run stefil suites and hu.dwim.stefil. The same code c…
…an't be used for both anymore, as they have become incompatible.
- Loading branch information
1 parent
b0a0b7b
commit 9cc58c4
Showing
13 changed files
with
169 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
#:fiveam-api | ||
#:eos-api | ||
#:stefil-api | ||
#:hu.dwim.stefil-api | ||
#:clunit-api | ||
#:nst-api) | ||
:components | ||
|
11 changes: 11 additions & 0 deletions
11
testsuites/apis-of-test-frameworks/hu.dwim.stefil-api-impl.asd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
;;; -*- Mode: LISP; Syntax: COMMON-LISP; indent-tabs-mode: nil; coding: utf-8; -*- | ||
;;; | ||
;;; Copyright (C) 2011 Anton Vodonosov (avodonosov@yandex.ru) | ||
;;; | ||
;;; See LICENSE for details. | ||
|
||
(asdf:defsystem #:hu.dwim.stefil-api-impl | ||
:version "0.1.0" | ||
:serial t | ||
:depends-on (#:hu.dwim.stefil-api #:hu.dwim.stefil) | ||
:components ((:file "hu.dwim.stefil-api-impl"))) |
34 changes: 34 additions & 0 deletions
34
testsuites/apis-of-test-frameworks/hu.dwim.stefil-api-impl.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(defpackage #:hu.dwim.stefil-api-impl | ||
(:use #:cl :hu.dwim.stefil-api)) | ||
|
||
(in-package #:hu.dwim.stefil-api-impl) | ||
|
||
(defun print-details (test-suite-result) | ||
(format t "~&~%-------------------------------------------------------------------------------------------------~%") | ||
(format t "The test result details (printed by cl-test-grid in addition to the standard Stefil output above)~%") | ||
(format t "~%(DESCRIBE RESULT):~%") | ||
(describe test-suite-result) | ||
(format t "~&~%Individual failures:~%") | ||
(map 'nil | ||
(lambda (descr) (format t "~A~%" descr)) | ||
(hu.dwim.stefil::failure-descriptions-of test-suite-result))) | ||
|
||
(defun run-test-suite (test-suite-name) | ||
(let* ((*debug-io* *standard-output*) | ||
(result (hu.dwim.stefil:funcall-test-with-feedback-message test-suite-name))) | ||
(print-details result) | ||
result)) | ||
|
||
(defun test-name (failure-description) | ||
(let ((hierarchical-names (mapcar | ||
#'(lambda (context) | ||
(hu.dwim.stefil::name-of | ||
(hu.dwim.stefil::test-of context))) | ||
(hu.dwim.stefil::test-context-backtrace-of failure-description)))) | ||
(format nil "~(~{~A~^.~}~)" (nreverse hierarchical-names)))) | ||
|
||
(defun failed-tests (test-suite-result) | ||
(remove-duplicates (map 'list | ||
#'test-name | ||
(hu.dwim.stefil::failure-descriptions-of test-suite-result)) | ||
:test #'string=)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
;;; -*- Mode: LISP; Syntax: COMMON-LISP; indent-tabs-mode: nil; coding: utf-8; -*- | ||
;;; | ||
;;; Copyright (C) 2011 Anton Vodonosov (avodonosov@yandex.ru) | ||
;;; | ||
;;; See LICENSE for details. | ||
|
||
(asdf:defsystem #:hu.dwim.stefil-api | ||
:version "0.1.0" | ||
:serial t | ||
:depends-on (#:api-dsl) | ||
:components ((:file "hu.dwim.stefil-api"))) |
25 changes: 25 additions & 0 deletions
25
testsuites/apis-of-test-frameworks/hu.dwim.stefil-api.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
(defpackage #:hu.dwim.stefil-api | ||
(:use :cl #:api-dsl) | ||
(:export #:run-test-suite | ||
#:failed-tests)) | ||
|
||
(in-package #:hu.dwim.stefil-api) | ||
|
||
(proclfun run-test-suite ((test-suite-name symbol)) t | ||
"Runs the Stefil test stuite specified by TEST-SUITE-NAME and returns | ||
an opaque result object. The result object may be passed to the FAILED-TESTS | ||
function to retreive the list of failed tests.") | ||
|
||
(proclfun failed-tests ((test-suite-result t)) list | ||
"List of failed test names. Test names are downcased strings. | ||
The TEST-SUITE-RESULT parameter must be a result of the RUN-TEST-SUITE | ||
function.") | ||
|
||
;; Stefil has a macro with-expected-failures, but we don't know | ||
;; how it is intended to be used - to register "known" failues, or for some | ||
;; other purpose. So far none of the libraries added to cl-test-grid | ||
;; use this feature, therefore we do not distinguish the failure-description | ||
;; having expected-p = t from other failure-descriptions. | ||
;; | ||
;; When we meet the first library using with-expected-failures, we will | ||
;; see how to support it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
testsuites/sample-test-suites/hu.dwim.stefil-sample-test-suite.asd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
;;; -*- Mode: LISP; Syntax: COMMON-LISP; indent-tabs-mode: nil; coding: utf-8; -*- | ||
;;; | ||
;;; Copyright (C) 2011 Anton Vodonosov (avodonosov@yandex.ru) | ||
;;; | ||
;;; See LICENSE for details. | ||
|
||
(asdf:defsystem #:hu.dwim.stefil-sample-test-suite | ||
:version "0.1.0" | ||
:serial t | ||
:depends-on (#:hu.dwim.stefil) | ||
:components ((:file "hu.dwim.stefil-sample-test-suite"))) |
34 changes: 34 additions & 0 deletions
34
testsuites/sample-test-suites/hu.dwim.stefil-sample-test-suite.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(defpackage #:hu.dwim.stefil-sample-test-suite | ||
(:use #:cl :hu.dwim.stefil)) | ||
|
||
(in-package #:hu.dwim.stefil-sample-test-suite) | ||
|
||
(defsuite sample-stefil-suite) | ||
(in-suite sample-stefil-suite) | ||
|
||
(deftest ok-test () | ||
(is (= (+ 2 2) 4))) | ||
|
||
(deftest one-fail-test () | ||
(is (= (+ 2 2) 3))) | ||
|
||
(deftest two-fails-test () | ||
(is (= (+ 2 2) 3)) | ||
(is (= (+ 1 1) 2)) | ||
(is (= (+ 3 3) 7))) | ||
|
||
(deftest error-test () | ||
(is (= 7 7)) | ||
(is (= (/ 1 0) 1))) | ||
|
||
(deftest all-fails-expected-test () | ||
(with-expected-failures | ||
(is (= (+ 2 2) 3)) | ||
(is (= (+ 1 1) 2)) | ||
(is (= (+ 3 3) 7)))) | ||
|
||
(deftest not-all-fails-expected-test () | ||
(is (= (+ 2 2) 3)) | ||
(with-expected-failures | ||
(is (= (+ 1 1) 2)) | ||
(is (= (+ 3 3) 7)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters