Skip to content

Commit

Permalink
Created more unit tests for last selection command.
Browse files Browse the repository at this point in the history
  • Loading branch information
evandrocoan committed Dec 6, 2017
1 parent d980557 commit fc21b14
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 6 deletions.
4 changes: 2 additions & 2 deletions clear_cursors_carets.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def run_tests():
# Comment all the tests names on this list, to run all Unit Tests
unit_tests_to_run = \
[
# "test_first_selection_with_2_selections_at_last_word",
# "test_2_selections_at_last_word",
# "test_last_selection_with_6_selections_plus_redundant_expand_at_last_word",
]

Expand All @@ -133,6 +133,6 @@ def plugin_loaded():
https://stackoverflow.com/questions/15971735/running-single-test-from-unittest-testcase-via-command-line
"""
pass
run_tests()
# run_tests()


53 changes: 49 additions & 4 deletions tests/clear_cursors_carets_last_selection_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

class ClearCursorsCaretsLastSelectionUnitTests(sys.modules["ClearCursorsCarets.tests.utilities"].BasicSublimeTextViewTestCase):

def test_1_selections_at_last_word(self):
def test_1_selections_at_first_word(self):
self.create_test_text(0)
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "single_selection_last" )

region = self.view.sel()[0]
self.assertEqual( sublime.Region(0, 4), region )

def test_2_selections_at_last_word(self):
def test_2_selections_at_first_word(self):
self.create_test_text(0)
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
Expand All @@ -25,7 +25,7 @@ def test_2_selections_at_last_word(self):
region = self.view.sel()[0]
self.assertEqual( sublime.Region(5, 9), region )

def test_6_selections_at_last_word(self):
def test_6_selections_at_first_word(self):
self.create_test_text(0)
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
Expand All @@ -38,7 +38,7 @@ def test_6_selections_at_last_word(self):
region = self.view.sel()[0]
self.assertEqual( sublime.Region(26, 30), region )

def test_6_selections_plus_redundant_expand_at_last_word(self):
def test_6_selections_plus_redundant_expand_at_first_word(self):
self.create_test_text(0)
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
Expand All @@ -51,4 +51,49 @@ def test_6_selections_plus_redundant_expand_at_last_word(self):
region = self.view.sel()[0]
self.assertEqual( sublime.Region(26, 30), region )

def test_2_selections_at_last_word(self):
self.create_test_text(26)
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "single_selection_last" )

region = self.view.sel()[0]
self.assertEqual( sublime.Region(0, 4), region )

def test_3_selections_at_last_word(self):
self.create_test_text(26)
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "single_selection_last" )

region = self.view.sel()[0]
self.assertEqual( sublime.Region(5, 9), region )

def test_6_selections_at_last_word(self):
self.create_test_text(26)
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "single_selection_last" )

region = self.view.sel()[0]
self.assertEqual( sublime.Region(21, 25), region )

def test_6_selections_at_last_word_plus_redundant_expansion_at_last_word(self):
self.create_test_text(26)
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "find_under_expand" )
self.view.window().run_command( "single_selection_last" )

region = self.view.sel()[0]
self.assertEqual( sublime.Region(21, 25), region )

0 comments on commit fc21b14

Please sign in to comment.