Add tests for 'pattern-plain?'.

* tests/unit/pattern.scm: Add tests for 'pattern-plain?'.
This commit is contained in:
Timothy Sample 2019-08-19 19:11:13 -04:00
parent dd215ee926
commit a009118efb
1 changed files with 22 additions and 1 deletions

View File

@ -1,5 +1,5 @@
;;; Gash -- Guile As SHell
;;; Copyright © 2018 Timothy Sample <samplet@ngyro.com>
;;; Copyright © 2018, 2019 Timothy Sample <samplet@ngyro.com>
;;;
;;; This file is part of Gash.
;;;
@ -164,6 +164,27 @@
;; TODO: Test quoting.
;;; Plain patterns
(test-assert "Recognizes plain patterns"
(pattern-plain? (parse-pattern "foo")))
(test-assert "Asterisks at the start are not plain"
(not (pattern-plain? (parse-pattern "*foo"))))
(test-assert "Asterisks at the end are not plain"
(not (pattern-plain? (parse-pattern "foo*"))))
(test-assert "Asterisks in the middle are not plain"
(not (pattern-plain? (parse-pattern "f*o"))))
(test-assert "Question marks are not plain"
(not (pattern-plain? (parse-pattern "f?o"))))
(test-assert "Character classes are not plain"
(not (pattern-plain? (parse-pattern "[fo]o"))))
(test-end)
;; Local Variables: