diff options
| author | Stephen Blott | 2016-10-23 16:02:53 +0100 |
|---|---|---|
| committer | GitHub | 2016-10-23 16:02:53 +0100 |
| commit | 458c7401394a8e2a97dbddfbf850b643990a1e70 (patch) | |
| tree | e637b7cc11efc4332c6662388a1c8de3abb33896 /tests | |
| parent | f01c01383d5826a028d4c5c2c43d7b5f18f2fef2 (diff) | |
| parent | 4486be1f40c582bf159e034f590cb82cb84caafc (diff) | |
| download | vimium-458c7401394a8e2a97dbddfbf850b643990a1e70.tar.bz2 | |
Merge pull request #2315 from smblott-github/better-line-parsing
Better line parsing (for custom key mappings)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit_tests/commands_test.coffee | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit_tests/commands_test.coffee b/tests/unit_tests/commands_test.coffee index 2c2e9542..0e0be1d6 100644 --- a/tests/unit_tests/commands_test.coffee +++ b/tests/unit_tests/commands_test.coffee @@ -1,5 +1,6 @@ require "./test_helper.js" extend global, require "./test_chrome_stubs.js" +extend global, require "../../background_scripts/bg_utils.js" global.Settings = {postUpdateHooks: {}, get: (-> ""), set: ->} {Commands} = require "../../background_scripts/commands.js" @@ -97,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 |
