@@ -187,8 +187,8 @@ TEST(Test_TypeScript_Test, json_file_is_not_linted) {
187
187
TypeScript_Test_Units units =
188
188
extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
189
189
ASSERT_EQ (units.size (), 2 );
190
- std::optional<Linter_Options> options = units[1 ].get_linter_options ();
191
- ASSERT_FALSE (options .has_value ());
190
+ std::optional<File_Language> language = units[1 ].get_language ();
191
+ ASSERT_FALSE (language .has_value ());
192
192
}
193
193
194
194
{
@@ -199,8 +199,8 @@ TEST(Test_TypeScript_Test, json_file_is_not_linted) {
199
199
TypeScript_Test_Units units =
200
200
extract_units_from_typescript_test (std::move (file), u8" hello.json" );
201
201
ASSERT_EQ (units.size (), 2 );
202
- std::optional<Linter_Options> options = units[0 ].get_linter_options ();
203
- ASSERT_FALSE (options .has_value ());
202
+ std::optional<File_Language> language = units[0 ].get_language ();
203
+ ASSERT_FALSE (language .has_value ());
204
204
}
205
205
}
206
206
@@ -213,9 +213,9 @@ TEST(Test_TypeScript_Test, typescript_file_is_linted) {
213
213
TypeScript_Test_Units units =
214
214
extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
215
215
ASSERT_EQ (units.size (), 2 );
216
- std::optional<Linter_Options> options = units[0 ].get_linter_options ();
217
- ASSERT_TRUE (options .has_value ());
218
- EXPECT_EQ (options-> language , File_Language::typescript);
216
+ std::optional<File_Language> language = units[0 ].get_language ();
217
+ ASSERT_TRUE (language .has_value ());
218
+ EXPECT_EQ (* language, File_Language::typescript);
219
219
}
220
220
221
221
{
@@ -226,9 +226,9 @@ TEST(Test_TypeScript_Test, typescript_file_is_linted) {
226
226
TypeScript_Test_Units units =
227
227
extract_units_from_typescript_test (std::move (file), u8" hello.json" );
228
228
ASSERT_EQ (units.size (), 2 );
229
- std::optional<Linter_Options> options = units[1 ].get_linter_options ();
230
- ASSERT_TRUE (options .has_value ());
231
- EXPECT_EQ (options-> language , File_Language::typescript);
229
+ std::optional<File_Language> language = units[1 ].get_language ();
230
+ ASSERT_TRUE (language .has_value ());
231
+ EXPECT_EQ (* language, File_Language::typescript);
232
232
}
233
233
}
234
234
@@ -241,9 +241,9 @@ TEST(Test_TypeScript_Test, typescript_react_file_is_linted) {
241
241
TypeScript_Test_Units units =
242
242
extract_units_from_typescript_test (std::move (file), u8" hello.tsx" );
243
243
ASSERT_EQ (units.size (), 2 );
244
- std::optional<Linter_Options> options = units[0 ].get_linter_options ();
245
- ASSERT_TRUE (options .has_value ());
246
- EXPECT_EQ (options-> language , File_Language::typescript_jsx);
244
+ std::optional<File_Language> language = units[0 ].get_language ();
245
+ ASSERT_TRUE (language .has_value ());
246
+ EXPECT_EQ (* language, File_Language::typescript_jsx);
247
247
}
248
248
249
249
{
@@ -254,9 +254,9 @@ TEST(Test_TypeScript_Test, typescript_react_file_is_linted) {
254
254
TypeScript_Test_Units units =
255
255
extract_units_from_typescript_test (std::move (file), u8" hello.json" );
256
256
ASSERT_EQ (units.size (), 2 );
257
- std::optional<Linter_Options> options = units[1 ].get_linter_options ();
258
- ASSERT_TRUE (options .has_value ());
259
- EXPECT_EQ (options-> language , File_Language::typescript_jsx);
257
+ std::optional<File_Language> language = units[1 ].get_language ();
258
+ ASSERT_TRUE (language .has_value ());
259
+ EXPECT_EQ (* language, File_Language::typescript_jsx);
260
260
}
261
261
}
262
262
@@ -267,9 +267,9 @@ TEST(Test_TypeScript_Test, typescript_definition_file) {
267
267
TypeScript_Test_Units units =
268
268
extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
269
269
ASSERT_EQ (units.size (), 1 );
270
- std::optional<Linter_Options> options = units[0 ].get_linter_options ();
271
- ASSERT_TRUE (options .has_value ());
272
- EXPECT_EQ (options-> language , File_Language::typescript_definition);
270
+ std::optional<File_Language> language = units[0 ].get_language ();
271
+ ASSERT_TRUE (language .has_value ());
272
+ EXPECT_EQ (* language, File_Language::typescript_definition);
273
273
}
274
274
275
275
TEST (Test_TypeScript_Test, typescript_definition_file_with_weird_extension) {
@@ -279,9 +279,9 @@ TEST(Test_TypeScript_Test, typescript_definition_file_with_weird_extension) {
279
279
TypeScript_Test_Units units =
280
280
extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
281
281
ASSERT_EQ (units.size (), 1 );
282
- std::optional<Linter_Options> options = units[0 ].get_linter_options ();
283
- ASSERT_TRUE (options .has_value ());
284
- EXPECT_EQ (options-> language , File_Language::typescript_definition);
282
+ std::optional<File_Language> language = units[0 ].get_language ();
283
+ ASSERT_TRUE (language .has_value ());
284
+ EXPECT_EQ (* language, File_Language::typescript_definition);
285
285
}
286
286
287
287
TEST (Test_TypeScript_Test, javascript_file_is_linted) {
@@ -294,15 +294,15 @@ TEST(Test_TypeScript_Test, javascript_file_is_linted) {
294
294
extract_units_from_typescript_test (std::move (file), u8" hello.js" );
295
295
ASSERT_EQ (units.size (), 2 );
296
296
297
- std::optional<Linter_Options> options = units[0 ].get_linter_options ();
298
- ASSERT_TRUE (options .has_value ());
297
+ std::optional<File_Language> language = units[0 ].get_language ();
298
+ ASSERT_TRUE (language .has_value ());
299
299
// FIXME(strager): Should we only enable jsx if a @jsx directive is present?
300
- EXPECT_EQ (options-> language , File_Language::javascript_jsx);
300
+ EXPECT_EQ (* language, File_Language::javascript_jsx);
301
301
302
- options = units[1 ].get_linter_options ();
303
- ASSERT_TRUE (options .has_value ());
302
+ language = units[1 ].get_language ();
303
+ ASSERT_TRUE (language .has_value ());
304
304
// FIXME(strager): Should we only enable jsx if a @jsx directive is present?
305
- EXPECT_EQ (options-> language , File_Language::javascript_jsx);
305
+ EXPECT_EQ (* language, File_Language::javascript_jsx);
306
306
}
307
307
}
308
308
@@ -316,13 +316,13 @@ TEST(Test_TypeScript_Test, javascript_react_file_is_linted) {
316
316
extract_units_from_typescript_test (std::move (file), u8" hello.jsx" );
317
317
ASSERT_EQ (units.size (), 2 );
318
318
319
- std::optional<Linter_Options> options = units[0 ].get_linter_options ();
320
- ASSERT_TRUE (options .has_value ());
321
- EXPECT_EQ (options-> language , File_Language::javascript_jsx);
319
+ std::optional<File_Language> language = units[0 ].get_language ();
320
+ ASSERT_TRUE (language .has_value ());
321
+ EXPECT_EQ (* language, File_Language::javascript_jsx);
322
322
323
- options = units[1 ].get_linter_options ();
324
- ASSERT_TRUE (options .has_value ());
325
- EXPECT_EQ (options-> language , File_Language::javascript_jsx);
323
+ language = units[1 ].get_language ();
324
+ ASSERT_TRUE (language .has_value ());
325
+ EXPECT_EQ (* language, File_Language::javascript_jsx);
326
326
}
327
327
}
328
328
@@ -337,9 +337,9 @@ TEST(Test_TypeScript_Test, markdown_unit_is_ignored) {
337
337
TypeScript_Test_Units units =
338
338
extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
339
339
ASSERT_EQ (units.size (), 3 );
340
- EXPECT_TRUE (units[0 ].get_linter_options ().has_value ());
341
- EXPECT_FALSE (units[1 ].get_linter_options ().has_value ());
342
- EXPECT_TRUE (units[2 ].get_linter_options ().has_value ());
340
+ EXPECT_TRUE (units[0 ].get_language ().has_value ());
341
+ EXPECT_FALSE (units[1 ].get_language ().has_value ());
342
+ EXPECT_TRUE (units[2 ].get_language ().has_value ());
343
343
}
344
344
345
345
TEST (Test_TypeScript_Test, files_in_node_modules_are_ignored) {
@@ -352,7 +352,7 @@ TEST(Test_TypeScript_Test, files_in_node_modules_are_ignored) {
352
352
TypeScript_Test_Units units =
353
353
extract_units_from_typescript_test (std::move (file), u8" hello.js" );
354
354
ASSERT_EQ (units.size (), 1 );
355
- EXPECT_FALSE (units[0 ].get_linter_options ().has_value ());
355
+ EXPECT_FALSE (units[0 ].get_language ().has_value ());
356
356
}
357
357
}
358
358
}
0 commit comments