+ describe "when inside an unfinished string" do
+ it "does not indent" do
+ vim.feedkeys 'i"test:\<ESC>'
+ vim.echo('synIDattr(synID(line("."), col("."), 0), "name")'
+ ).downcase.should include 'string'
+ vim.feedkeys 'a\<CR>'
+ proposed_indent.should == 0
+ indent.should == 0
+ end
+
+ it "does not dedent" do
+ vim.feedkeys 'iif True:\<CR>"test:\<ESC>'
+ vim.echo('synIDattr(synID(line("."), col("."), 0), "name")'
+ ).downcase.should include 'string'
+ proposed_indent.should == shiftwidth
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when the previous line has a colon in a string" do
+ before { vim.feedkeys 'itest(":".join(["1","2"]))\<CR>' }
+ it "does not indent" do
+ vim.feedkeys 'if True:'
+ indent.should == 0
+ proposed_indent.should == 0
+ end
+ end
+
+ describe "when the previous line has a list slice" do
+ it "does not indent" do
+ vim.feedkeys 'ib = a[2:]\<CR>'
+ indent.should == 0
+ proposed_indent.should == 0
+ end
+ end
+
+ describe "when after an '(' that is followed by an unfinished string" do
+ before { vim.feedkeys 'itest("""' }
+
+ it "it does not indent the next line" do
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == 0
+ indent.should == 0
+ end
+
+ it "with contents it does not indent the next line" do
+ vim.feedkeys 'string_contents\<CR>'
+ proposed_indent.should == 0
+ indent.should == 0
+ end
+ end
+
+ describe "when after assigning an unfinished string" do
+ before { vim.feedkeys 'itest = """' }
+
+ it "it does not indent the next line" do
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == 0
+ indent.should == 0
+ end
+ end
+
+ describe "when after assigning an unfinished string" do
+ before { vim.feedkeys 'i test = """' }
+
+ it "it does not indent the next line" do
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == 0
+ indent.should == 0
+ end
+ end
+
+ describe "when after assigning a finished string" do
+ before { vim.feedkeys 'i test = ""' }
+
+ it "it does indent the next line" do
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == 4
+ indent.should == 4
+ end
+
+ it "and writing a new string, it does indent the next line" do
+ vim.feedkeys '\<CR>""'
+ proposed_indent.should == 4
+ indent.should == 4
+ end
+ end
+
+ describe "when after a docstring" do
+ before { vim.feedkeys 'i """' }
+
+ it "it does indent the next line" do
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == 4
+ indent.should == 4
+ end
+ end
+