From a009118efb852acfc3948b7e2cbccf28cd4b0dbe Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Mon, 19 Aug 2019 19:11:13 -0400 Subject: [PATCH] Add tests for 'pattern-plain?'. * tests/unit/pattern.scm: Add tests for 'pattern-plain?'. --- tests/unit/pattern.scm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/unit/pattern.scm b/tests/unit/pattern.scm index a31206b..6b51d61 100644 --- a/tests/unit/pattern.scm +++ b/tests/unit/pattern.scm @@ -1,5 +1,5 @@ ;;; Gash -- Guile As SHell -;;; Copyright © 2018 Timothy Sample +;;; Copyright © 2018, 2019 Timothy Sample ;;; ;;; 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: