forked from coala/coala-bears
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoVetBearTest.py
32 lines (26 loc) · 1.14 KB
/
GoVetBearTest.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
import os
from queue import Queue
from shutil import which
from unittest.case import skipIf
from bears.go.GoVetBear import GoVetBear
from coalib.testing.LocalBearTestHelper import LocalBearTestHelper
from coalib.settings.Section import Section
@skipIf(which('go') is None, 'go is not installed')
class GoVetBearTest(LocalBearTestHelper):
def setUp(self):
self.section = Section('test section')
self.uut = GoVetBear(self.section, Queue())
def test_syntax_error(self):
good_file = os.path.join(os.path.dirname(__file__),
'test_files',
'vet_good.go')
bad_file = os.path.join(os.path.dirname(__file__),
'test_files',
'vet_bad_semantics.go')
self.check_validity(self.uut, [], good_file)
self.check_invalidity(self.uut, [], bad_file)
def test_semantic_error(self):
bad_file = os.path.join(os.path.dirname(__file__),
'test_files',
'vet_bad_syntax.go')
self.check_invalidity(self.uut, [], bad_file)