def testReturnsFullParagraph_CountOne(self): text = ( 'line 1 in paragraph 1', 'line 2 in paragraph 1', 'line 3 in paragraph 1', '', 'line 1 in paragraph 2', 'line 2 in paragraph 2', 'line 3 in paragraph 2', '', 'line 1 in paragraph 3', 'line 2 in paragraph 3', 'line 3 in paragraph 3', ) set_text(self.view, '\n'.join(text)) r = self.R((4, 2), (4, 2)) add_sel(self.view, r) expected = ( 'line 1 in paragraph 2\n', 'line 2 in paragraph 2\n', 'line 3 in paragraph 2\n', ) reg = find_paragraph_text_object(self.view, r, inclusive=False) self.assertEqual(''.join(expected), self.view.substr(reg))
def runTests(self, data): for (i, td) in enumerate(data): # Get method params from the Vim motion. count = int(td.motion[0:-2]) inclusive = td.motion[-2] == 'a' # Set up the view. self.write(TEXT) self.clear_sel() s = self.R(*td.start_region) self.add_sel(s) # Expected vs actual region returned by find_paragraph_text_object(). exp = self.R(*td.expected_region) got = find_paragraph_text_object(self.view, s, inclusive=inclusive, count=count) rcs = [ region2rowcols(self.view, r) for r in (exp, got) ] msg = self.MSG_FMT.format(td.msg, td.motion, *rcs) self.assert_equal_regions(exp, got, msg)