Skip to content

Commit

Permalink
#635 create a test to check new line encoding on .sh files
Browse files Browse the repository at this point in the history
  • Loading branch information
svennissel committed Jun 15, 2022
1 parent 6391858 commit 94a3f0e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions olv-dist/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ distZip {
archiveBaseName.set("olv")
dependsOn(configurations.instrumentedClasspath)
}

test {
useTestNG()
maxParallelForks = 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package pl.otros.logview.dist;

import org.testng.annotations.Test;
import org.testng.reporters.Files;

import java.io.File;
import java.io.IOException;

import static org.testng.AssertJUnit.assertFalse;

public class FileNewLineEncodingTest {
@Test
public void testShellScriptUnixNewLineEncoding() throws IOException {
assertFalse("The file olv.sh contains widows new line ('\\r'). Remove it or you cannot use this script with linux!", readFile("olv.sh").contains("\r"));
assertFalse("The file olv-batch.sh contains widows new line ('\\r'). Remove it or you cannot use this script with linux!", readFile("olv-batch.sh").contains("\r"));
}

private String readFile(String file) throws IOException {
return Files.readFile(new File("src/main/dist/" + file));
}
}

0 comments on commit 94a3f0e

Please sign in to comment.