Emitter { public static String sourceFileString(File file) { String path = FileUtils.getRelativePath(Options.getRootDirectory(), file); if (File.separatorChar == '\\') { path = FileUtils.slashify(path); } return path.replace("\\", "\\\\"); } Emitter(String outputFileName, File inputFile, LexParse parser, DFA dfa, PrintWriter writer); static File normalize(String name, File input); static String sourceFileString(File file); void emit();  }
@Test public void testSourceFileString() { Options.resetRootDirectory(); String bad = "something/or_other\\filename\\nFILE_NAMES_MUST_BE_ESCAPED\\u000A.flex"; if (File.separatorChar == '\\') { assertThat(Emitter.sourceFileString(new File(bad))) .isEqualTo("something/or_other/filename/nFILE_NAMES_MUST_BE_ESCAPED/u000A.flex"); } else { assertThat(Emitter.sourceFileString(new File(bad))) .isEqualTo("something/or_other\\\\filename\\\\nFILE_NAMES_MUST_BE_ESCAPED\\\\u000A.flex"); } }