From 767f80e7296c41a4428c73cadc90b953d252f8d7 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 28 Aug 2025 20:09:50 +0100 Subject: e2e-tests: Add tests based off of examples in the ccwl manual. --- e2e-tests/tools/spell-check.scm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 e2e-tests/tools/spell-check.scm (limited to 'e2e-tests/tools/spell-check.scm') diff --git a/e2e-tests/tools/spell-check.scm b/e2e-tests/tools/spell-check.scm new file mode 100644 index 0000000..d5ccebb --- /dev/null +++ b/e2e-tests/tools/spell-check.scm @@ -0,0 +1,33 @@ +(define split-words + (command #:inputs text + #:run "tr" "--complement" "--squeeze-repeats" "A-Za-z" "\\n" + #:stdin text + #:outputs (words #:type stdout))) + +(define downcase + (command #:inputs words + #:run "tr" "A-Z" "a-z" + #:stdin words + #:outputs (downcased-words #:type stdout))) + +(define sort + (command #:inputs words + #:run "sort" "--unique" + #:stdin words + #:outputs (sorted #:type stdout))) + +(define find-misspellings + (command #:inputs words dictionary + #:run "comm" "-23" words dictionary + #:outputs (misspellings #:type stdout) + #:stdout "misspelt-words")) + +(workflow (text-file dictionary) + (pipe (tee (pipe (split-words #:text text-file) + (downcase #:words words) + (sort (sort-words) #:words downcased-words) + (rename #:sorted-words sorted)) + (pipe (sort (sort-dictionary) #:words dictionary) + (rename #:sorted-dictionary sorted))) + (find-misspellings #:words sorted-words + #:dictionary sorted-dictionary))) -- cgit 1.4.1