Get it from here: guillermooo@bitbucket.org/guill … gintesting
This is a very experimental package to enable users to test plugins easily.
Basically, it sets up an environment where you can use unittest to test your plugin’s code.
Currently it doesn’t do much, but here’s how it works:
- write your plugin. For example:
[code]import sublime, sublimeplugin
class SampleCommand(sublimeplugin.TextCommand):
def run(self, view, args):
sublime.statusMessage(args)
def aTest(self, view):
return 0[/code]
- view.runCommand(“newTestFile”) (there are no keybindings/menus yet, sorry)
- write tests like so:
[code]import unittest
import sublimeunittest
#===============================================================================
Import your plugins and any Python lib available on your system.
Add your tests below this header.
Remember you’re using your system’s Python!
#===============================================================================
sample imports
import sublime
import echoes
import sublimeplugin
class ATestCase(unittest.TestCase):
def setUp(self):
self.v = sublime.View()
def testThisThing(self):
echoes.SampleCommand().run(self.v, "hey")
self.assertEquals("hey", sublime.MESSAGE_SINK"statusMessage"])
def testThisoOtherThing(self):
self.assertEquals(0, echoes.SampleCommand().aTest(self.v))
if name == “main”:
unittest.main()[/code]
- $ /Packages//tests/test.py
About 0.00000000000001 % of ST functionality is implemented, so use it mainly to test functions that don’t use the ST API.