Skip to content

Commit d9626cf

Browse files
committed
Add Travis CI config file
1 parent 87e7a18 commit d9626cf

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

Diff for: .travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: python
2+
sudo: false
3+
python:
4+
- "3.6"
5+
install: "pip install -r requirements.txt"
6+
script:
7+
- python -m unittest discover -s test

Diff for: requirements.txt

Whitespace-only changes.

Diff for: test/test_natvis.py

+11-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import unittest
33

4+
import templates
45
from natvis import NatvisDocument, DisplayStringParser, FormatSpecifiers, NatvisManager
56

67

@@ -73,7 +74,7 @@ def test_format(self):
7374
class NatvisTestCase(unittest.TestCase):
7475
def print_document(self, doc: NatvisDocument):
7576
for type in doc.types:
76-
print(type.name + ":")
77+
print(str(type.template_type) + ":")
7778
for parser in type.display_parsers:
7879
print(" " + repr(parser))
7980

@@ -84,52 +85,37 @@ def test_glm_parsing(self):
8485

8586
self.assertEqual(len(doc.types), 6)
8687

87-
self.print_document(doc)
88-
8988
def test_gsl_parsing(self):
9089
path = os.path.join(os.path.dirname(__file__), "data", "GSL.natvis")
9190

9291
doc = NatvisDocument.parse_file(path)
9392

9493
self.assertEqual(len(doc.types), 9)
9594

96-
self.print_document(doc)
97-
9895
def test_lua_parsing(self):
9996
path = os.path.join(os.path.dirname(__file__), "data", "lua.natvis")
10097

10198
doc = NatvisDocument.parse_file(path)
10299

103100
self.assertEqual(len(doc.types), 10)
104101

105-
self.print_document(doc)
106-
107-
def test_template_parsing(self):
108-
path = os.path.join(os.path.dirname(__file__), "data", "template.natvis")
109-
110-
doc = NatvisDocument.parse_file(path)
111-
112-
self.assertEqual(len(doc.types), 10)
113-
114-
self.print_document(doc)
115-
116102

117103
class NatvisManagerTestCase(unittest.TestCase):
118104
def test_lookup_type(self):
119105
manager = NatvisManager()
120106

121107
manager.load_natvis_file(os.path.join(os.path.dirname(__file__), "data", "glm.natvis"))
122108

123-
self.assertIsNotNone(manager.lookup_type("glm::tvec1<float>"))
124-
self.assertIsNotNone(manager.lookup_type("glm::tvec1<int>"))
109+
self.assertIsNotNone(manager.lookup_type(templates.parse_template_type("glm::tvec1<float>")))
110+
self.assertIsNotNone(manager.lookup_type(templates.parse_template_type("glm::tvec1<int>")))
125111

126-
self.assertIsNotNone(manager.lookup_type("glm::tvec2<float>"))
127-
self.assertIsNotNone(manager.lookup_type("glm::tvec2<int>"))
112+
self.assertIsNotNone(manager.lookup_type(templates.parse_template_type("glm::tvec2<float>")))
113+
self.assertIsNotNone(manager.lookup_type(templates.parse_template_type("glm::tvec2<int>")))
128114

129-
self.assertIsNotNone(manager.lookup_type("glm::tvec3<float>"))
130-
self.assertIsNotNone(manager.lookup_type("glm::tvec3<int>"))
115+
self.assertIsNotNone(manager.lookup_type(templates.parse_template_type("glm::tvec3<float>")))
116+
self.assertIsNotNone(manager.lookup_type(templates.parse_template_type("glm::tvec3<int>")))
131117

132-
self.assertIsNotNone(manager.lookup_type("glm::tvec4<float>"))
133-
self.assertIsNotNone(manager.lookup_type("glm::tvec4<int>"))
118+
self.assertIsNotNone(manager.lookup_type(templates.parse_template_type("glm::tvec4<float>")))
119+
self.assertIsNotNone(manager.lookup_type(templates.parse_template_type("glm::tvec4<int>")))
134120

135-
self.assertIsNone(manager.lookup_type("lua_State"))
121+
self.assertIsNone(manager.lookup_type(templates.parse_template_type("lua_State")))

0 commit comments

Comments
 (0)