aboutsummaryrefslogtreecommitdiff
path: root/examples.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-09-09 11:09:10 -0700
committercolin <colin@cicadas.surf>2023-09-09 13:59:36 -0700
commit4025722943ae814c88da1fa8fe5778cffecce4ad (patch)
tree12ca12b13dc53913eab33d61e5c7eeea946699e0 /examples.lisp
parent1bb8d1f8826e21314aae0a96dc25d088afad36f5 (diff)
Testiere2
Add examples changed some internal names; improved some error messages Added more examples renaming exports Added New Readme
Diffstat (limited to 'examples.lisp')
-rw-r--r--examples.lisp72
1 files changed, 0 insertions, 72 deletions
diff --git a/examples.lisp b/examples.lisp
deleted file mode 100644
index b515b98..0000000
--- a/examples.lisp
+++ /dev/null
@@ -1,72 +0,0 @@
-(defpackage :testiere.examples
- (:use #:cl)
- (:import-from #:testiere
- #:defun/t
- #:with-stubs))
-
-(in-package :testiere.examples)
-
-(defun test-fibble ()
- (assert (= 13 (fibble 1 2))))
-
-(defun/t fibble (x y &key (z 10))
- "Hey, a docstring."
- :tests
- (:program test-fibble)
- :end
- (+ x y z))
-
-(defvar *count*)
-
-(defun/t increment-count ()
- "Increments the *count* variable."
- :tests
- (:let ((*count* 4))
- (:afterp () (lambda () (= *count* 5)))
- (= () 6)
- (:outputp () (lambda (x) (= x 7))))
- :end
- (incf *count*))
-
-(defun/t other-increment-count (&optional (amount 1))
- "Also increments the *count* variable by an optional amount."
- :tests
- (:let ((*count* 10))
- (= () 11))
- (:let ((*count* 0))
- (= (10) 10)
- (:afterp (2) (lambda () (= *count* 12))))
- :end
- (incf *count* amount))
-
-
-(defun just-a-function ()
- (print "Just a function."))
-
-(defun/t call-just-a-function ()
- "Calls JUST-A-FUNCTION."
- :tests
- (:with-stubs ((just-a-function () (print "TEMP JUST-A-FUNCTION.")))
- (equal () "TEMP JUST-A-FUNCTION."))
- :end
- (just-a-function))
-
-
-(defun make-drakma-request ()
- "Make an HTTP request using DRAKMA"
- ;; implemented elsewhere
- )
-
-(defun test-url-word-counter ()
- (with-stubs
- ((make-drakma-request () "one two three four five six seven"))
- (assert (= (count-words) 7))))
-
-(defun/t count-words ()
- "Fetches a url and counts now many words the page contains."
- :tests
- (:program test-url-word-counter)
- :end
- (let ((fetched
- (make-drakma-request)))
- (1+ (count #\space fetched))))