-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
test_fuse_util.py
42 lines (33 loc) · 1.36 KB
/
test_fuse_util.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import unittest
try:
from .fuse_util import *
except:
from fuse_util import *
class TestFuseUtil(unittest.TestCase):
def test_getExtension(self):
self.assertEqual(getExtension(None), "")
self.assertEqual(getExtension(""), "")
self.assertEqual(getExtension("foo.ux"), "ux")
self.assertEqual(getExtension("foo/bar.ux"), "ux")
self.assertEqual(getExtension(".profile"), "")
def test_isSupportedSyntax(self):
self.assertTrue(isSupportedSyntax("Uno"))
self.assertTrue(isSupportedSyntax("UX"))
self.assertFalse(isSupportedSyntax("uno"))
self.assertFalse(isSupportedSyntax(".uno"))
self.assertFalse(isSupportedSyntax(""))
self.assertFalse(isSupportedSyntax(None))
self.assertFalse(isSupportedSyntax(42))
def test_getSyntax(self):
self.assertEqual(getSyntax(MockSettingsView("Packages/Fuse/UX.tmLanguage")), "UX")
self.assertEqual(getSyntax(MockSettingsView("Packages/Fuse/Uno.tmLanguage")), "Uno")
def test_getRowCol(self):
self.assertEqual( {"Line": 21, "Character": 31}, getRowCol(MockRowColView(), 10))
class MockSettingsView:
def __init__(self, language):
self.language = language
def settings(self):
return {"syntax" :self.language}
class MockRowColView:
def rowcol(self, pos):
return (pos + 10, pos + 20)