Add the suffix field for config.toml
@@ -9,15 +9,20 @@ from onlinejudge_verify.languages.other import OtherLanguage
_dict: Dict[str, Language] = {}
-_dict['.cpp'] = CPlusPlusLanguage()
-_dict['.hpp'] = _dict['.cpp']
-_dict['.csx'] = CSharpScriptLanguage()
+_dict['.test.cpp'] = CPlusPlusLanguage()
+_dict['.test.hpp'] = _dict['.test.cpp']
+_dict['.test.csx'] = CSharpScriptLanguage()
config_path = pathlib.Path('.verify-helper/config.toml')
if config_path.exists():
for ext, config in toml.load(str(config_path)).get('languages', {}).items():
- _dict['.' + ext] = OtherLanguage(config=config)
+ suffix = config.get('suffix', '.test.' + ext)
+ _dict[suffix] = OtherLanguage(config=config)
def get(path: pathlib.Path) -> Optional[Language]:
- return _dict.get(path.suffix)
+ for suffix, language in _dict.items():
+ if str(path.name).endswith(suffix):
+ return language
+ else:
+ return None
