Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: python
python:
- "3.3"

#run tests
#script: python -m unittest
35 changes: 35 additions & 0 deletions source/json-generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3

import os
import fnmatch
from json import dumps, load

def writeJson(data, filename):
try:
jsondata = dumps(data, indent=2, skipkeys=True, sort_keys=True)
fd = open(filename, 'w')
fd.write(jsondata)
fd.close()
except:
print 'ERROR writing', filename
pass

def getDir(path, ext):
matches = []
for root, dirnames, filenames in os.walk(path):
for filename in fnmatch.filter(filenames, ext):
matches.append(os.path.join(root, filename))
return matches


result = []
for file in getDir('../snippets/', '*.sublime-snippet'):
line = open(file)
content = line.read()
trigger = content.split('<tabTrigger>')[1].split('</tabTrigger>')[0]
description = content.split('<description>')[1].split('</description>')[0]

result.append({'trigger':trigger, 'description':description})

writeJson(result, "../snippets.json")

22 changes: 22 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3

import unittest

class TestStringMethods(unittest.TestCase):

def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')

def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())

def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ['hello', 'world'])
# check that s.split fails when the separator is not a string
with self.assertRaises(TypeError):
s.split(2)

if __name__ == '__main__':
unittest.main()
Empty file added tests/unittest_compat.py
Empty file.