Beispiel #1
0
    def testRetursRequestedStartLineNumber(self):
        self.write('''aaa aaa
bbb bbb
ccc ccc
ddd ddd
''')
        self.clear_sel()
        self.add_sel(self.R((0, 0), (0, 0)))
        region = RangeNode(start=[TokenDigits('2')]).resolve(self.view)
        self.assert_equal_regions(self.R(8, 16), region)
Beispiel #2
0
    def testCanCalculateVisualStart(self):
        self.write('''xxx xxx
aaa aaa
xxx xxx
bbb bbb
''')
        self.clear_sel()
        self.add_sel(self.R(8, 10))
        region = RangeNode(start=[TokenDigits('0')]).resolve(self.view)
        self.assert_equal_regions(self.R(-1, -1), region)
Beispiel #3
0
 def testCanScanDigits(self):
     scanner = Scanner("100")
     tokens = list(scanner.scan())
     self.assertEqual([TokenDigits('100'), TokenEof()], tokens)
Beispiel #4
0
 def test_CanParseWithStartAndEndLines(self):
     parsed = parse_command_line('4,5s')
     self.assertEqual(parsed.line_range.start, [TokenDigits('4')])
     self.assertEqual(parsed.line_range.end, [TokenDigits('5')])
     self.assertEqual(parsed.command.content, 'substitute')
Beispiel #5
0
 def test_CanParseWithZeroAndDollar(self):
     parsed = parse_command_line('0,$s')
     self.assertEqual(parsed.line_range.start, [TokenDigits('0')])
     self.assertEqual(parsed.line_range.end, [TokenDollar()])
     self.assertEqual(parsed.command.content, 'substitute')
Beispiel #6
0
 def test_CanParseWithSimpleRange(self):
     parsed = parse_command_line('4s')
     self.assertEqual(parsed.line_range.start, [TokenDigits('4')])
     self.assertEqual(parsed.command.content, 'substitute')
Beispiel #7
0
 def test_CanParseLongSequence(self):
     # Vim allows this.
     parsed = parse_command_line('1,2,3,4')
     self.assertEqual(parsed.line_range.start, [TokenDigits('3')])
     self.assertEqual(parsed.line_range.end, [TokenDigits('4')])
Beispiel #8
0
 def test_CanParseNumberRightHandSide(self):
     parsed = parse_command_line(',10')
     self.assertEqual(parsed.line_range.start, [])
     self.assertEqual(parsed.line_range.end, [TokenDigits('10')])
Beispiel #9
0
 def test_CanParseNumber(self):
     parsed = parse_command_line('10')
     self.assertEqual(parsed.line_range.start, [TokenDigits('10')])
Beispiel #10
0
 def test_CanParseDollarWithCompany(self):
     parsed = parse_command_line('0,$')
     self.assertEqual(parsed.line_range.start, [TokenDigits('0')])
     self.assertEqual(parsed.line_range.end, [TokenDollar()])