private static IResult <TO2Module> TryParseModuleFile(string baseDir, string moduleFile) { string content = File.ReadAllText(Path.Combine(baseDir, moduleFile), Encoding.UTF8); IResult <TO2Module> moduleResult = TO2ParserModule.Module(TO2Module.BuildName(moduleFile)).TryParse(content, moduleFile); if (!moduleResult.WasSuccessful) { return(Result.Failure <TO2Module>(moduleResult.Remaining, moduleResult.Expected)); } return(Result.Success(moduleResult.Remaining, moduleResult.Value)); }
public void TestBuildModuleName() { Assert.Equal("test_testcontext", TO2Module.BuildName("Test-TestContext.to2")); Assert.Equal("sub::mod::demo", TO2Module.BuildName("sub\\mod\\demo.to2")); Assert.Equal("sub::mod::demo34", TO2Module.BuildName("sub/mod/demo34")); }