Refactor illegal delimiters specs

This commit is contained in:
Jacob Wahlgren 2015-09-22 00:50:21 +02:00
parent e2841dc26c
commit 77d3fa46d5

View file

@ -449,19 +449,19 @@ describe "the commands", ->
submitNormalModeInputText(':%substitute/abc/ghi/ig') submitNormalModeInputText(':%substitute/abc/ghi/ig')
expect(editor.getText()).toEqual('ghiaghi\ndefdDEF\nghiaghi') expect(editor.getText()).toEqual('ghiaghi\ndefdDEF\nghiaghi')
it "can't be delimited by letters", -> describe "illegal delimiters", ->
test = (delim) ->
keydown(':') keydown(':')
submitNormalModeInputText(':substitute nanxngi') submitNormalModeInputText(":substitute #{delim}a#{delim}x#{delim}gi")
expect(atom.notifications.notifications[0].message).toEqual( expect(atom.notifications.notifications[0].message).toEqual(
"Command error: Regular expressions can't be delimited by alphanumeric characters, '\\', '\"' or '|'") "Command error: Regular expressions can't be delimited by alphanumeric characters, '\\', '\"' or '|'")
expect(editor.getText()).toEqual('abcaABC\ndefdDEF\nabcaABC') expect(editor.getText()).toEqual('abcaABC\ndefdDEF\nabcaABC')
it "can't be delimited by numbers", -> it "can't be delimited by letters", -> test 'n'
keydown(':') it "can't be delimited by numbers", -> test '3'
submitNormalModeInputText(':substitute 1a1x1gi') it "can't be delimited by '\\'", -> test '\\'
expect(atom.notifications.notifications[0].message).toEqual( it "can't be delimited by '\"'", -> test '"'
"Command error: Regular expressions can't be delimited by alphanumeric characters, '\\', '\"' or '|'") it "can't be delimited by '|'", -> test '|'
expect(editor.getText()).toEqual('abcaABC\ndefdDEF\nabcaABC')
describe "capturing groups", -> describe "capturing groups", ->
beforeEach -> beforeEach ->