Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LanguageNormalizer.ts を 2023年8月の言語アップデートで増えた新形式の言語選択肢に対応しました。 #1431

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
expect(normalizeLanguage("Perl6 (rakudo-star 2016.01)")).toBe("Raku");
expect(normalizeLanguage("Rust (1.42.0)")).toBe("Rust");
expect(normalizeLanguage("C++11 (Clang++ 3.4)")).toBe("C++");
expect(normalizeLanguage("C++ 20 (gcc 12.2)")).toBe("C++");
expect(normalizeLanguage("Scala (2.11.7)")).toBe("Scala");
expect(normalizeLanguage("Scala 3.3.0 (Scala Native 0.4.14)")).toBe("Scala");
expect(normalizeLanguage("Fortran(GNU Fortran 9.2.1)")).toBe("Fortran");
expect(normalizeLanguage("C# 11.9 (.NET 7.0.7)")).toBe("C#");
expect(normalizeLanguage("F# 7.0 (.NET 7.0.7)")).toBe("F#");
expect(normalizeLanguage("Visual Basic 16.9 (.NET 7.0.7)")).toBe("Visual Basic");

Check failure on line 14 in atcoder-problems-frontend/src/utils/LanguageNormalizer.test.ts

View workflow job for this annotation

GitHub Actions / Run frontend tests

Replace `"Visual·Basic"` with `⏎····"Visual·Basic"⏎··`
expect(normalizeLanguage("TypeScript 5.1 (Node.js 18.16.1)")).toBe("TypeScript");

Check failure on line 15 in atcoder-problems-frontend/src/utils/LanguageNormalizer.test.ts

View workflow job for this annotation

GitHub Actions / Run frontend tests

Replace `"TypeScript"` with `⏎····"TypeScript"⏎··`
});
2 changes: 1 addition & 1 deletion atcoder-problems-frontend/src/utils/LanguageNormalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export const normalizeLanguage = (language: string): string => {
if (language.startsWith("Perl6")) {
return "Raku";
} else {
return language.replace(/\d*\s*\(.*\)$/, "");
return language.replace(/\s*(\d+(\.\d+)*)*\s*\(.*\)$/, "");
}
};
Loading