Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions test/coverage_filename_encoding/Test.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package coverage_filename_encoding

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class Test extends SpecWithJUnit {
"testA1" in new Scope {
A1.a1(true) must_!= 1
"testA1" in {
A1.a1(true) must be_!=(1)
}
}
14 changes: 8 additions & 6 deletions test/coverage_specs2_with_junit/TestWithSpecs2WithJUnit.scala
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
package coverage_specs2_with_junit

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope

class TestWithSpecs2WithJUnit extends SpecWithJUnit {
"testA1" in new Scope {
A1.a1(true) must_== B1
"testA1" in {
A1.a1(true) must be_==(B1)
}

"testA2" in new Scope {
"testA2" in {
A2.a2()
success
}

"testD1" in new Scope {
"testD1" in {
D1.veryLongFunctionNameIsHereAaaaaaaaa()
success
}

"testE1" in new Scope {
"testE1" in {
E1.e1("test")
success
}
}
20 changes: 10 additions & 10 deletions test/shell/test_scala_specs2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ scala_specs2_junit_test_test_filter_one_test(){
local output=$(bazel test \
--nocache_test_results \
--test_output=streamed \
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#specs2 tests should::run smoothly in bazel$' \
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#specs2 tests::run smoothly in bazel$' \
test:Specs2Tests)
local expected="+ run smoothly in bazel"
local unexpected="+ not run smoothly in bazel"
Expand Down Expand Up @@ -90,7 +90,7 @@ scala_specs2_junit_test_test_filter_exact_match(){
local output=$(bazel test \
--nocache_test_results \
--test_output=streamed \
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2AnotherTest#other specs2 tests should::run from another test$' \
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2AnotherTest#other specs2 tests::run from another test$' \
test:Specs2Tests)
local expected="+ run from another test"
local unexpected="+ run from another test 2"
Expand All @@ -112,7 +112,7 @@ scala_specs2_junit_test_test_filter_exact_match_unsafe_characters(){
local output=$(bazel test \
--nocache_test_results \
--test_output=streamed \
'--test_filter=scalarules.test.junit.specs2.JunitSpec2RegexTest#\Qtests with unsafe characters should::2 + 2 != 5\E$' \
'--test_filter=scalarules.test.junit.specs2.JunitSpec2RegexTest#\Qtests with unsafe characters::2 + 2 != 5\E$' \
test:Specs2Tests)
local expected="+ 2 + 2 != 5"
local unexpected="+ work escaped (with regex)"
Expand All @@ -134,7 +134,7 @@ scala_specs2_junit_test_test_filter_exact_match_escaped_and_sanitized(){
local output=$(bazel test \
--nocache_test_results \
--test_output=streamed \
'--test_filter=scalarules.test.junit.specs2.JunitSpec2RegexTest#\Qtests with unsafe characters should::work escaped [with regex]\E$' \
'--test_filter=scalarules.test.junit.specs2.JunitSpec2RegexTest#\Qtests with unsafe characters::work escaped [with regex]\E$' \
test:Specs2Tests)
local expected="+ work escaped (with regex)"
local unexpected="+ 2 + 2 != 5"
Expand All @@ -156,7 +156,7 @@ scala_specs2_junit_test_test_filter_match_multiple_methods(){
local output=$(bazel test \
--nocache_test_results \
--test_output=streamed \
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2AnotherTest#other specs2 tests should::(\Qrun from another test\E|\Qrun from another test 2\E)$' \
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2AnotherTest#other specs2 tests::(\Qrun from another test\E|\Qrun from another test 2\E)$' \
test:Specs2Tests)
local expected=(
"+ run from another test"
Expand Down Expand Up @@ -222,7 +222,7 @@ scala_specs2_all_tests_show_in_the_xml(){
--test_output=streamed \
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#' \
test:Specs2Tests
matches=$(grep -c -e "testcase name='specs2 tests should::run smoothly in bazel'" -e "testcase name='specs2 tests should::not run smoothly in bazel'" ./bazel-testlogs/test/Specs2Tests/test.xml)
matches=$(grep -c -e "testcase name='specs2 tests::run smoothly in bazel'" -e "testcase name='specs2 tests::not run smoothly in bazel'" ./bazel-testlogs/test/Specs2Tests/test.xml)
if [ $matches -eq 2 ]; then
return 0
else
Expand All @@ -236,9 +236,9 @@ scala_specs2_only_filtered_test_shows_in_the_xml(){
bazel test \
--nocache_test_results \
--test_output=streamed \
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#specs2 tests should::run smoothly in bazel$' \
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#specs2 tests::run smoothly in bazel$' \
test:Specs2Tests
matches=$(grep -c -e "testcase name='specs2 tests should::run smoothly in bazel'" -e "testcase name='specs2 tests should::not run smoothly in bazel'" ./bazel-testlogs/test/Specs2Tests/test.xml)
matches=$(grep -c -e "testcase name='specs2 tests::run smoothly in bazel'" -e "testcase name='specs2 tests::not run smoothly in bazel'" ./bazel-testlogs/test/Specs2Tests/test.xml)
if [ $matches -eq 1 ]; then
return 0
else
Expand All @@ -253,10 +253,10 @@ scala_specs2_only_failed_test_shows_in_the_xml(){
bazel test \
--nocache_test_results \
--test_output=streamed \
'--test_filter=scalarules.test.junit.specs2.SuiteWithOneFailingTest#specs2 tests should::fail$' \
'--test_filter=scalarules.test.junit.specs2.SuiteWithOneFailingTest#specs2 tests::fail$' \
test_expect_failure/scala_junit_test:specs2_failing_test
echo "got results"
matches=$(grep -c -e "testcase name='specs2 tests should::fail'" -e "testcase name='specs2 tests should::succeed'" ./bazel-testlogs/test_expect_failure/scala_junit_test/specs2_failing_test/test.xml)
matches=$(grep -c -e "testcase name='specs2 tests::fail'" -e "testcase name='specs2 tests::succeed'" ./bazel-testlogs/test_expect_failure/scala_junit_test/specs2_failing_test/test.xml)
if [ $matches -eq 1 ]; then
return 0
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scalarules.test.junit.support.JUnitCompileTimeDep

class JunitSpecs2Test extends SpecWithJUnit {

"specs2 tests" should {
"specs2 tests" >> {
"run smoothly in bazel" in {
println(JUnitCompileTimeDep.hello)
success
Expand All @@ -19,7 +19,7 @@ class JunitSpecs2Test extends SpecWithJUnit {

class JunitSpecs2AnotherTest extends SpecWithJUnit {

"other specs2 tests" should {
"other specs2 tests" >> {
"run from another test" >> {
println(JUnitCompileTimeDep.hello)
success
Expand All @@ -30,7 +30,7 @@ class JunitSpecs2AnotherTest extends SpecWithJUnit {
}
}

"unrelated test" should {
"unrelated test" >> {
"not run" in {
success
}
Expand All @@ -39,7 +39,7 @@ class JunitSpecs2AnotherTest extends SpecWithJUnit {

class JunitSpec2RegexTest extends SpecWithJUnit {

"tests with unsafe characters" should {
"tests with unsafe characters" >> {
"2 + 2 != 5" in {
2 + 2 must be_!=(5)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package scalarules.test.location_expansion
import org.specs2.mutable.SpecWithJUnit
class LocationExpansionTest extends SpecWithJUnit {

"tests" should {
"tests" >> {
"support location expansion" >> {
sys.props.get("location.expanded") must beSome(contain("worker"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.specs2.mutable.SpecWithJUnit

class ScalaLibOnlyResourcesFilegroupTest extends SpecWithJUnit {

"Scala library with no srcs and only filegroup resources" should {
"Scala library with no srcs and only filegroup resources" >> {
"allow to load resources" >> {
get("/resource.txt") must beEqualTo("I am a text resource!")
get("/subdir/resource.txt") must beEqualTo("I am a text resource in a subdir!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.specs2.mutable.SpecWithJUnit

class ScalaLibOnlyResourcesTest extends SpecWithJUnit {

"Scala library with no srcs and only resources" should {
"Scala library with no srcs and only resources" >> {
"allow to load resources" >> {
get("/resource.txt") must beEqualTo("I am a text resource!")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.specs2.mutable.SpecWithJUnit

class ScalaLibResourcesFromExternalDepTest extends SpecWithJUnit {

"Scala library depending on resources from external resource-only jar" should {
"Scala library depending on resources from external resource-only jar" >> {
"allow to load resources" >> {
get("/external/test_new_local_repo/resource.txt") must beEqualTo("A resource\n")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.specs2.mutable.SpecificationWithJUnit

class ResourceStripPrefixTest extends SpecificationWithJUnit {

"resource_strip_prefix" should {
"resource_strip_prefix" >> {
"strip the prefix on nosrc jar" in {
val resource = getClass.getResourceAsStream("/nosrc_jar_resource.txt")
resource must not beNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.lucidchart.relate.SqlRow

class ScalaImportExposesJarsTest extends SpecificationWithJUnit {

"scala_import" should {
"scala_import" >> {
"enable importing jars from files" in {
println(classOf[SqlRow])
success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.apache.commons.lang3.ArrayUtils
import org.specs2.mutable.SpecWithJUnit

class ScalaImportExposesJarsTest extends SpecWithJUnit {
"scala_import" should {
"scala_import" >> {
"enable using the jars it exposes" in {
println(classOf[Cache[String, String]])
println(classOf[ArrayUtils])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.specs2.mutable.SpecificationWithJUnit

class ScalaImportPropagatesRuntimeDepsTest extends SpecificationWithJUnit {

"scala_import" should {
"scala_import" >> {
"propagate runtime deps" in {
println(Class.forName("com.google.common.cache.Cache"))
println(Class.forName("org.apache.commons.lang3.ArrayUtils"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.specs2.mutable.SpecificationWithJUnit
import scala.util.control.NonFatal

class ScalaImportNeverLinkTest extends SpecificationWithJUnit {
"neverlinked scala_import" should {
"neverlinked scala_import" >> {
"not be available in runtime" in {
//ScalaImportNeverLink class is packaged in scala_import_never_link.jar. Since the scala_import target
//is marked as "neverlink" - this test class/target will be built successfully but will fail on runtime with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.specs2.mutable.SpecificationWithJUnit

class ScalaImportPropagatesCompileDepsTest extends SpecificationWithJUnit {

"scala_import" should {
"scala_import" >> {
"propagate compile time deps" in {
println(classOf[Cache[String, String]])
println(classOf[ArrayUtils])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import org.specs2.mutable.SpecWithJUnit

class SuiteWithOneFailingTest extends SpecWithJUnit {

"specs2 tests" should {
"specs2 tests" >> {
"succeed" >> success
"fail" >> failure("boom")
}

"some other suite" should {
"some other suite" >> {
"do stuff" >> success
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scalarules.test.junit.support.JUnitCompileTimeDep

class JunitSpecs2Test extends SpecWithJUnit {

"specs2 tests" should {
"specs2 tests" >> {
"run smoothly in bazel" in {
println(JUnitCompileTimeDep.hello)
success
Expand All @@ -19,7 +19,7 @@ class JunitSpecs2Test extends SpecWithJUnit {

class JunitSpecs2AnotherTest extends SpecWithJUnit {

"other specs2 tests" should {
"other specs2 tests" >> {
"run from another test" >> {
println(JUnitCompileTimeDep.hello)
success
Expand All @@ -30,7 +30,7 @@ class JunitSpecs2AnotherTest extends SpecWithJUnit {
}
}

"unrelated test" should {
"unrelated test" >> {
"not run" in {
success
}
Expand All @@ -39,7 +39,7 @@ class JunitSpecs2AnotherTest extends SpecWithJUnit {

class JunitSpec2RegexTest extends SpecWithJUnit {

"tests with unsafe characters" should {
"tests with unsafe characters" >> {
"2 + 2 != 5" in {
2 + 2 must be_!=(5)
}
Expand Down