Skip to content

Commit

Permalink
Remove "default" validator.. it's not actually a validator (#11)
Browse files Browse the repository at this point in the history
* Remove "default" validator.. it's not actually a validator

* Disable email notifications
  • Loading branch information
fisxoj committed Aug 12, 2018
1 parent cadd42d commit d98e0a0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
language: common-lisp
sudo: false
notifications:
email: false

env:
global:
Expand Down
6 changes: 0 additions & 6 deletions src/validate.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,3 @@
(local-time::invalid-timestring (c)
(declare (ignore c))
(fail value "value is not a valid timestamp."))))

(defun default (value &optional (default-value ""))
"Provides a value if none is present."
(if (alexandria:emptyp value)
default-value
value))
7 changes: 1 addition & 6 deletions t/validate.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

(in-package :validate-test)

(plan 8)
(plan 7)

;; Test parsing

Expand Down Expand Up @@ -105,9 +105,4 @@
(is-error (v:timestamp "potato") 'v:<validation-error>
"Raises an error on an invalid timestamp."))

;; Default values
(subtest "Default"
(is (v:default nil "potato") "potato" "Supplies a value instead of nil.")
(is (v:default "" "potato") "potato" "Supplies a value for an empty string."))

(finalize)
2 changes: 1 addition & 1 deletion validate.asd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
|#

(defsystem validate
:version "0.6.0"
:version "0.7.0"
:author "Matt Novenstern"
:license "LLGPLv3"
:depends-on ("iterate"
Expand Down

0 comments on commit d98e0a0

Please sign in to comment.