@@ -187,8 +187,8 @@ TEST(Test_TypeScript_Test, json_file_is_not_linted) {
187187 TypeScript_Test_Units units =
188188 extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
189189 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 ());
192192 }
193193
194194 {
@@ -199,8 +199,8 @@ TEST(Test_TypeScript_Test, json_file_is_not_linted) {
199199 TypeScript_Test_Units units =
200200 extract_units_from_typescript_test (std::move (file), u8" hello.json" );
201201 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 ());
204204 }
205205}
206206
@@ -213,9 +213,9 @@ TEST(Test_TypeScript_Test, typescript_file_is_linted) {
213213 TypeScript_Test_Units units =
214214 extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
215215 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);
219219 }
220220
221221 {
@@ -226,9 +226,9 @@ TEST(Test_TypeScript_Test, typescript_file_is_linted) {
226226 TypeScript_Test_Units units =
227227 extract_units_from_typescript_test (std::move (file), u8" hello.json" );
228228 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);
232232 }
233233}
234234
@@ -241,9 +241,9 @@ TEST(Test_TypeScript_Test, typescript_react_file_is_linted) {
241241 TypeScript_Test_Units units =
242242 extract_units_from_typescript_test (std::move (file), u8" hello.tsx" );
243243 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);
247247 }
248248
249249 {
@@ -254,9 +254,9 @@ TEST(Test_TypeScript_Test, typescript_react_file_is_linted) {
254254 TypeScript_Test_Units units =
255255 extract_units_from_typescript_test (std::move (file), u8" hello.json" );
256256 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);
260260 }
261261}
262262
@@ -267,9 +267,9 @@ TEST(Test_TypeScript_Test, typescript_definition_file) {
267267 TypeScript_Test_Units units =
268268 extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
269269 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);
273273}
274274
275275TEST (Test_TypeScript_Test, typescript_definition_file_with_weird_extension) {
@@ -279,9 +279,9 @@ TEST(Test_TypeScript_Test, typescript_definition_file_with_weird_extension) {
279279 TypeScript_Test_Units units =
280280 extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
281281 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);
285285}
286286
287287TEST (Test_TypeScript_Test, javascript_file_is_linted) {
@@ -294,15 +294,15 @@ TEST(Test_TypeScript_Test, javascript_file_is_linted) {
294294 extract_units_from_typescript_test (std::move (file), u8" hello.js" );
295295 ASSERT_EQ (units.size (), 2 );
296296
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 ());
299299 // 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);
301301
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 ());
304304 // 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);
306306 }
307307}
308308
@@ -316,13 +316,13 @@ TEST(Test_TypeScript_Test, javascript_react_file_is_linted) {
316316 extract_units_from_typescript_test (std::move (file), u8" hello.jsx" );
317317 ASSERT_EQ (units.size (), 2 );
318318
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);
322322
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);
326326 }
327327}
328328
@@ -337,9 +337,9 @@ TEST(Test_TypeScript_Test, markdown_unit_is_ignored) {
337337 TypeScript_Test_Units units =
338338 extract_units_from_typescript_test (std::move (file), u8" hello.ts" );
339339 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 ());
343343}
344344
345345TEST (Test_TypeScript_Test, files_in_node_modules_are_ignored) {
@@ -352,7 +352,7 @@ TEST(Test_TypeScript_Test, files_in_node_modules_are_ignored) {
352352 TypeScript_Test_Units units =
353353 extract_units_from_typescript_test (std::move (file), u8" hello.js" );
354354 ASSERT_EQ (units.size (), 1 );
355- EXPECT_FALSE (units[0 ].get_linter_options ().has_value ());
355+ EXPECT_FALSE (units[0 ].get_language ().has_value ());
356356}
357357}
358358}
0 commit comments