diff --git a/build.gradle b/build.gradle index 9760a79fa..a60afe5f5 100644 --- a/build.gradle +++ b/build.gradle @@ -81,6 +81,11 @@ tasks.withType(Test) { task -> task.jvmArgs '-Djava.awt.headless=true' //this prevents awt from displaying a java icon while the tests are running } +task findScalaAndJavaTypes(type: Exec) { + description = "Check that Scala files only exist in the scala test dir and that java files do not reside in the scala test dir." + commandLine './scripts/checkScalaAndJavaFiles.sh' +} + test { description = "Runs the unit tests other than the SRA tests" @@ -98,7 +103,7 @@ test { if (System.env.CI == "false") exclude "sra" if (!OperatingSystem.current().isUnix()) exclude "unix" } -} +} dependsOn findScalaAndJavaTypes task testSRA(type: Test) { description = "Run the SRA tests" diff --git a/scripts/checkScalaAndJavaFiles.sh b/scripts/checkScalaAndJavaFiles.sh new file mode 100755 index 000000000..adadfd31c --- /dev/null +++ b/scripts/checkScalaAndJavaFiles.sh @@ -0,0 +1,17 @@ +#/bin/bash + +# Check that Scala files only exist in the scala test dir and +# that java files do not reside in the scala test dir + +if `find src | grep -v '^src/test/scala' | grep -q '\.scala$' ` ; then + echo 'Found scala file(s) outside of scala test directory'; + find src | grep -v '^src/test/scala' | grep '\.scala$' + exit 1; +fi + +if `find src/test/scala | grep -q '\.java$' ` ; then + echo 'Found java file(s) in scala test directory'; + find src/test/scala | grep '\.java$' + exit 1; +fi + diff --git a/src/test/scala/htsjdk/samtools/util/StringUtilTest.scala b/src/test/scala/htsjdk/samtools/util/StringUtilTest.scala index 6962e3674..35957d681 100644 --- a/src/test/scala/htsjdk/samtools/util/StringUtilTest.scala +++ b/src/test/scala/htsjdk/samtools/util/StringUtilTest.scala @@ -106,7 +106,7 @@ class StringUtilTest extends UnitSpec { StringUtil.assertCharactersNotInString("HelloWorld", ' ', '!', '_') } - val textForWrapping = + val textForWrapping: String = """This is a little bit |of text with nice short |lines.