def test_insert_single_owner_with_block_comments_happy_path(self): comment.set_block_comments() sublime.settings.set(constants.SETTING_OWNERS, u"Lifted Studios") self.command.run(self.edit) self.assertTrue(self.view.insertCalled) self.assertIs(self.edit, self.view.edit) self.assertEqual(0, self.view.location) self.assertEqual("/*\n|{0}|Lifted Studios|\n*/\n".format(self.year), self.view.text)
def test_get_comment_settings_block_comments_with_override(self): comment.set_block_comments() sublime.settings.set(constants.SETTING_LANGUAGES_USE_LINE_COMMENTS, u'Foo') sublime.settings.set(u'syntax', u'Packages/Foo/Foo.tmLanguage') self.command.get_comment_settings() self.assertEqual("// ", self.command.firstLine) self.assertEqual("// ", self.command.middleLine) self.assertEqual("// ", self.command.lastLine)
def test_insert_block_comments_with_zero_padding(self): comment.set_block_comments() sublime.settings.set(constants.SETTING_OWNERS, u"Lifted Studios") sublime.settings.set(constants.SETTING_PADDING, 0) self.command.run(self.edit) self.assertTrue(self.view.insertCalled) self.assertIs(self.edit, self.view.edit) self.assertEqual(0, self.view.location) self.assertEqual("/* |{0}|Lifted Studios| */\n".format(self.year), self.view.text)
def test_insert_multiple_owners_with_block_comments_happy_path(self): comment.set_block_comments() sublime.settings.set(constants.SETTING_OWNERS, multiple_owners) self.command.run(self.edit) self.assertEqual(multiple_owners, sublime.active_window().quick_panel_items) index = random.randint(0, (len(multiple_owners) - 1)) sublime.active_window().quick_panel_func(index) self.assertTrue(self.view.insertCalled) self.assertIs(self.edit, self.view.edit) self.assertEqual(0, self.view.location) self.assertEqual("/*\n|{0}|{1}|\n*/\n".format(self.year, multiple_owners[index]), self.view.text)