]> git.madduck.net Git - etc/vim.git/blob - spec/indent/bytes_spec.rb

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Fix outer "elif" with inner "if" (#136)
[etc/vim.git] / spec / indent / bytes_spec.rb
1 require "spec_helper"
2
3 describe "handles byte strings" do
4   before(:all) {
5       vim.command 'syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell'
6       vim.command "syn match pythonBytesEscape       '\\\\$'"
7   }
8
9   before(:each) {
10     # clear buffer
11     vim.normal 'gg"_dG'
12
13     # Insert two blank lines.
14     # The first line is a corner case in this plugin that would shadow the
15     # correct behaviour of other tests. Thus we explicitly jump to the first
16     # line when we require so.
17     vim.feedkeys 'i\<CR>\<CR>\<ESC>'
18   }
19
20   it "it does not indent to bracket in byte string" do
21     vim.feedkeys 'ireg = b"["\<Esc>'
22     vim.echo('map(synstack(line("."), col(".")), "synIDattr(v:val, \"name\")")'
23             ).should == "['pythonBytes']"
24     vim.feedkeys 'o'
25     indent.should == 0
26   end
27
28   it "it indents backslash continuation correctly" do
29     vim.feedkeys 'iwith foo, \<Bslash>\<Esc>'
30     vim.echo('getline(".")').should == "with foo, \\"
31     vim.echo('map(synstack(line("."), col(".")), "synIDattr(v:val, \"name\")")'
32             ).should == "['pythonBytesEscape']"
33     vim.feedkeys 'o'
34     indent.should == 8
35   end
36 end