]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/lint/vocabs/vocabs-tests.factor
Fix Linter
[factor.git] / extra / lint / vocabs / vocabs-tests.factor
index c34cea6ea3b439c34ce8c2f94521174857754e42..9b552e50218bc379ad0a0d98e4b12ca23ae12989 100644 (file)
@@ -2,8 +2,9 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs compiler.units continuations
 formatting hash-sets hashtables io io.encodings.utf8 io.files
-kernel namespaces regexp sequences sequences.deep sets sorting
-splitting tools.test unicode vocabs vocabs.loader ;
+kernel namespaces regexp sequences sequences.deep
+sequences.parser sets sorting splitting tools.test unicode
+vocabs vocabs.loader ;
 IN: lint.vocabs
 
 <PRIVATE
@@ -46,6 +47,18 @@ CONSTANT: empty-using-statement     "USING: ; nop ( -- ) ;"
 : ---- ( -- ) "-------------------------------------------------------------------------" print ;
 PRIVATE>
 
+"next-token should get the next non-blank string in the stream:" print
+{ "hello" } [ "hello world!"              <sequence-parser> next-token ] unit-test
+{ "hello" } [ "\n    hello \n world!    " <sequence-parser> next-token ] unit-test
+
+----
+
+"next-token should ignore comments:" print
+{ "world!" } [ "! hello\nworld!"                 <sequence-parser> next-token ] unit-test
+{ "world!" } [ "! h\n! e\n! l\n! l\n! o\nworld!" <sequence-parser> next-token ] unit-test
+
+----
+
 "It should work on multiple lines, with multiple imports across the file: " print
 
 { { "hashtables" "math.primes" "sequences" "sets" "vocabs" } } [ mock-file find-unused-in-string ] unit-test