X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/2de20d9c659d6350a6408dc1ec4aa6e0b1dea6ac..3f68af9813542a5e277b7a51b316644241c372d7:/.vim/bundle/vim-python-pep8-indent/spec/indent/bytes_spec.rb diff --git a/.vim/bundle/vim-python-pep8-indent/spec/indent/bytes_spec.rb b/.vim/bundle/vim-python-pep8-indent/spec/indent/bytes_spec.rb new file mode 100644 index 0000000..3d6744e --- /dev/null +++ b/.vim/bundle/vim-python-pep8-indent/spec/indent/bytes_spec.rb @@ -0,0 +1,36 @@ +require "spec_helper" + +describe "handles byte strings" do + before(:all) { + vim.command 'syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell' + vim.command "syn match pythonBytesEscape '\\\\$'" + } + + before(:each) { + # clear buffer + vim.normal 'gg"_dG' + + # Insert two blank lines. + # The first line is a corner case in this plugin that would shadow the + # correct behaviour of other tests. Thus we explicitly jump to the first + # line when we require so. + vim.feedkeys 'i\\\' + } + + it "it does not indent to bracket in byte string" do + vim.feedkeys 'ireg = b"["\' + vim.echo('map(synstack(line("."), col(".")), "synIDattr(v:val, \"name\")")' + ).should == "['pythonBytes']" + vim.feedkeys 'o' + indent.should == 0 + end + + it "it indents backslash continuation correctly" do + vim.feedkeys 'iwith foo, \\' + vim.echo('getline(".")').should == "with foo, \\" + vim.echo('map(synstack(line("."), col(".")), "synIDattr(v:val, \"name\")")' + ).should == "['pythonBytesEscape']" + vim.feedkeys 'o' + indent.should == 8 + end +end