File: StringHandlingModeTests.vimspec

package info (click to toggle)
vim-autopairs 4.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 444 kB
  • sloc: makefile: 4
file content (29 lines) | stat: -rw-r--r-- 1,158 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Describe String handling modes should be different
    Before each
        call autopairs#Variables#InitVariables()
        new | only!
    End
    It should default to 0
        call Expect(g:AutoPairsStringHandlingMode).to_equal(0)
    End
    It should expand in strings for option == 0
        call Expect('func("String ''').ToMatch('func("String ''''")')
        call Expect("func('String \"").ToMatch("func('String \"\"')")
    End
    It is going to handle in and out of strings poorly for option == 0
        call Expect('func("don''t").chain(''').ToMatch('func("don''t").chain('')')
    End
    It is going to handle in and out of strings better for option == 1
        new | only!
        set ft=cpp
        let b:AutoPairsStringHandlingMode = 1
        call Expect('func("don''t').ToMatch("func(\"don't\")")
        " sanity check tests

        call Expect(col('.')).to_equal(11)
        call Expect(line('.')).to_equal(1)
        syntax sync fromstart
        call Expect(autopairs#Strings#isInString()).to_be_true("There should be syngroups")
        call Expect("func(\"don't\<Esc>A.chain('").ToMatch('func("don''t").chain('''')')
    End
End