@@ -133,62 +133,15 @@ handleCommandLine(int argc, char* const* argv)
133
133
{
134
134
if (std::string (" --test" ).compare (argv[1 ]) == 0 )
135
135
{
136
- try
137
- {
138
- std::vector<std::string> expected = {
139
- " Mismatched types. Expected/LeftHand is: int." ,
140
- " Mismatched types. Expected/LeftHand is: i." ,
141
- " Mismatched types. Expected/LeftHand is: flt." ,
142
- " Mismatched types. Expected/LeftHand is: int or flt." ,
143
- " Mismatched types. Expected/LeftHand is: int." ,
144
- " Mismatched types. Expected/LeftHand is: int or flt." ,
145
- " Mismatched types. Expected/LeftHand is: int." ,
146
- " Mismatched types. Expected/LeftHand is: int." ,
147
- " Mismatched types. Expected/LeftHand is: int." ,
148
- " Mismatched types. Expected/LeftHand is: int or flt." ,
149
- " Mismatched types. Expected/LeftHand is: int or flt." ,
150
- " Mismatched types. Expected/LeftHand is: bool." ,
151
- " Mismatched types. Expected/LeftHand is: bool." ,
152
- " Mismatched types. Expected/LeftHand is: int or flt." ,
153
- " Mismatched types. Expected/LeftHand is: int or flt." ,
154
- " Mismatched types. Expected/LeftHand is: bool." ,
155
- " Mismatched types. Expected/LeftHand is: int." ,
156
- " Unexpected redeclaration of f, originally defined as type "
157
- " flt." ,
158
- " Missing keys in udt initialization for type: Foo" ,
159
- " Nonexistent member function." ,
160
- " Mismatched types. Expected/LeftHand is: flt." ,
161
- " Mismatched types. Expected/LeftHand is: int." ,
162
- " Mismatched types. Expected/LeftHand is: flt." ,
163
- " Nonexistent attribute." ,
164
- " Mismatched types. Expected/LeftHand is: int." ,
165
- " Function input parameter type mismatch in function call "
166
- " soFun" ,
167
- " Mismatched types. Expected/LeftHand is: flt." ,
168
- " Mismatched list types. Expected is: [int]." ,
169
- " Mismatched types. Expected/LeftHand is: bool." ,
170
- };
171
-
172
- sailfishc* sfc = new sailfishc (argv[2 ], false );
173
- sfc->parse ();
174
- auto errors = sfc->getErrors ();
175
-
176
- int i = 0 ;
177
- for (auto const & e : errors)
178
- {
179
- // std::cout << e->getMsg() << " " << expected[i] <<
180
- // std::endl; assert(e->getMsg() == expected[i++]);
181
- std::cout << e->getMsg () << std::endl;
182
- }
183
- }
184
- catch (const std::string msg)
185
- {
186
- std::cerr << msg;
187
- }
188
- catch (char const * msg)
189
- {
190
- std::cerr << msg;
191
- }
136
+ Prettify::Formatter red (Prettify::FG_RED);
137
+ Prettify::Formatter green (Prettify::FG_GREEN);
138
+ Prettify::Formatter normal (Prettify::RESET);
139
+
140
+ bool result = SEMANTIC_ANALYSIS_TEST (argv[2 ]);
141
+ if (result)
142
+ std::cout << green << " SUCCESSFUL TEST!" << ' \n ' << normal ;
143
+ else
144
+ std::cout << red << " TEST FAILED!" << ' \n ' << normal ;
192
145
}
193
146
else if (std::string (" --compile_c" ).compare (argv[1 ]) == 0 )
194
147
{
0 commit comments