aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStephen Blott2016-10-23 16:00:08 +0100
committerStephen Blott2016-10-23 16:00:08 +0100
commit4486be1f40c582bf159e034f590cb82cb84caafc (patch)
treee637b7cc11efc4332c6662388a1c8de3abb33896 /tests
parentdecf9a145d4a1f7107fe0ce533765891960f5555 (diff)
downloadvimium-4486be1f40c582bf159e034f590cb82cb84caafc.tar.bz2
Better line parsing (add tests).
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/commands_test.coffee16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unit_tests/commands_test.coffee b/tests/unit_tests/commands_test.coffee
index 12f4496a..0e0be1d6 100644
--- a/tests/unit_tests/commands_test.coffee
+++ b/tests/unit_tests/commands_test.coffee
@@ -98,6 +98,22 @@ context "Validate advanced commands",
for command in Commands.advancedCommands
assert.isTrue 0 <= @allCommands.indexOf command
+context "Parse commands",
+ should "omit whitespace", ->
+ assert.equal 0, BgUtils.parseLines(" \n \n ").length
+
+ should "omit comments", ->
+ assert.equal 0, BgUtils.parseLines(" # comment \n \" comment \n ").length
+
+ should "join lines", ->
+ assert.equal 1, BgUtils.parseLines("a\\\nb").length
+ assert.equal "ab", BgUtils.parseLines("a\\\nb")[0]
+
+ should "trim lines", ->
+ assert.equal 2, BgUtils.parseLines(" a \n b").length
+ assert.equal "a", BgUtils.parseLines(" a \n b")[0]
+ assert.equal "b", BgUtils.parseLines(" a \n b")[1]
+
# TODO (smblott) More tests:
# - Ensure each background command has an implmentation in BackgroundCommands
# - Ensure each foreground command has an implmentation in vimium_frontent.coffee