rendered paste body /** * Test the {@link SVNClientInterface.diff()} APIs. * @since 1.5 */ public void testDiffEOL() throws SubversionException, IOException { OneTest thisTest = new OneTest(true); File diffOutput = new File(super.localTmp, thisTest.testName); final String NL = System.getProperty("line.separator"); final String sepLine = "===================================================================" + NL; final String underSepLine = "___________________________________________________________________" + NL; final String expectedDiffBody = "@@ -1 +1 @@" + NL + "-This is the file 'iota'." + NL + "\\ No newline at end of file" + NL + "+This is the file 'mu'." + NL + "\\ No newline at end of file" + NL; // Set svn:eol-style=native on iota String iotaPath = thisTest.getWCPath().replace('\\', '/') + "/iota"; client.propertyCreate(iotaPath, "svn:eol-style", "native", false); String[] paths = new String[] {iotaPath}; addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(), "iota",NodeKind.file, CommitItemStateFlags.PropMods); client.commit(paths, "Set svn:eol-style to native", false); // Two-path diff of WC paths. PrintWriter writer = new PrintWriter(new FileOutputStream(iotaPath)); writer.print("This is the file 'mu'."); writer.flush(); writer.close(); String expectedDiffOutput = "Index: " + iotaPath + NL + sepLine + "--- " + iotaPath + "\t(revision 1)" + NL + "+++ " + iotaPath + "\t(working copy)" + NL + expectedDiffBody; client.diff(iotaPath, Revision.BASE, iotaPath, Revision.WORKING, diffOutput.getPath(), false, true, true, false); assertFileContentsEquals("Unexpected diff output in file '" + diffOutput.getPath() + '\'', expectedDiffOutput, diffOutput); // Peg revision diff of a single file. client.diff(thisTest.getUrl() + "/iota", Revision.HEAD, new Revision.Number(1), Revision.HEAD, diffOutput.getPath(), false, true, true, false); assertFileContentsEquals("Unexpected diff output in file '" + diffOutput.getPath() + '\'', "", diffOutput); diffOutput.delete(); // Test svn diff with a relative path. String wcPath = fileToSVNPath(new File(thisTest.getWCPath()), false); expectedDiffOutput = "Index: iota" + NL + sepLine + "--- iota\t(revision 1)" + NL + "+++ iota\t(working copy)" + NL + expectedDiffBody; client.diff(iotaPath, Revision.BASE, iotaPath, Revision.WORKING, wcPath, diffOutput.getPath(), Depth.infinity, true, true, false); assertFileContentsEquals("Unexpected diff output in file '" + diffOutput.getPath() + '\'', expectedDiffOutput, diffOutput); // Test svn diff with a relative path and trailing slash. wcPath = fileToSVNPath(new File(thisTest.getWCPath() + "/"), false); client.diff(iotaPath, Revision.BASE, iotaPath, Revision.WORKING, wcPath, diffOutput.getPath(), Depth.infinity, true, true, false); assertFileContentsEquals("Unexpected diff output in file '" + diffOutput.getPath() + '\'', expectedDiffOutput, diffOutput); }