1
1
import os
2
2
import unittest
3
3
4
+ import templates
4
5
from natvis import NatvisDocument , DisplayStringParser , FormatSpecifiers , NatvisManager
5
6
6
7
@@ -73,7 +74,7 @@ def test_format(self):
73
74
class NatvisTestCase (unittest .TestCase ):
74
75
def print_document (self , doc : NatvisDocument ):
75
76
for type in doc .types :
76
- print (type .name + ":" )
77
+ print (str ( type .template_type ) + ":" )
77
78
for parser in type .display_parsers :
78
79
print (" " + repr (parser ))
79
80
@@ -84,52 +85,37 @@ def test_glm_parsing(self):
84
85
85
86
self .assertEqual (len (doc .types ), 6 )
86
87
87
- self .print_document (doc )
88
-
89
88
def test_gsl_parsing (self ):
90
89
path = os .path .join (os .path .dirname (__file__ ), "data" , "GSL.natvis" )
91
90
92
91
doc = NatvisDocument .parse_file (path )
93
92
94
93
self .assertEqual (len (doc .types ), 9 )
95
94
96
- self .print_document (doc )
97
-
98
95
def test_lua_parsing (self ):
99
96
path = os .path .join (os .path .dirname (__file__ ), "data" , "lua.natvis" )
100
97
101
98
doc = NatvisDocument .parse_file (path )
102
99
103
100
self .assertEqual (len (doc .types ), 10 )
104
101
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
-
116
102
117
103
class NatvisManagerTestCase (unittest .TestCase ):
118
104
def test_lookup_type (self ):
119
105
manager = NatvisManager ()
120
106
121
107
manager .load_natvis_file (os .path .join (os .path .dirname (__file__ ), "data" , "glm.natvis" ))
122
108
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>" ) ))
125
111
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>" ) ))
128
114
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>" ) ))
131
117
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>" ) ))
134
120
135
- self .assertIsNone (manager .lookup_type ("lua_State" ))
121
+ self .assertIsNone (manager .lookup_type (templates . parse_template_type ( "lua_State" ) ))
0 commit comments