Skip to content

Commit ab1bc5b

Browse files
author
Mantas Sakalauskas
authored
feat(specs2): remove scope and shoulds (#1333)
* feat(specs2): remove scope and shoulds * fix(build): fix expectations * fix(build): additional expectations
1 parent bd11f61 commit ab1bc5b

File tree

16 files changed

+40
-39
lines changed

16 files changed

+40
-39
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package coverage_filename_encoding
22

33
import org.specs2.mutable.SpecWithJUnit
4-
import org.specs2.specification.Scope
54

65
class Test extends SpecWithJUnit {
7-
"testA1" in new Scope {
8-
A1.a1(true) must_!= 1
6+
"testA1" in {
7+
A1.a1(true) must be_!=(1)
98
}
109
}
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
package coverage_specs2_with_junit
22

33
import org.specs2.mutable.SpecWithJUnit
4-
import org.specs2.specification.Scope
54

65
class TestWithSpecs2WithJUnit extends SpecWithJUnit {
7-
"testA1" in new Scope {
8-
A1.a1(true) must_== B1
6+
"testA1" in {
7+
A1.a1(true) must be_==(B1)
98
}
109

11-
"testA2" in new Scope {
10+
"testA2" in {
1211
A2.a2()
12+
success
1313
}
1414

15-
"testD1" in new Scope {
15+
"testD1" in {
1616
D1.veryLongFunctionNameIsHereAaaaaaaaa()
17+
success
1718
}
1819

19-
"testE1" in new Scope {
20+
"testE1" in {
2021
E1.e1("test")
22+
success
2123
}
2224
}

test/shell/test_scala_specs2.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ scala_specs2_junit_test_test_filter_one_test(){
3939
local output=$(bazel test \
4040
--nocache_test_results \
4141
--test_output=streamed \
42-
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#specs2 tests should::run smoothly in bazel$' \
42+
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#specs2 tests::run smoothly in bazel$' \
4343
test:Specs2Tests)
4444
local expected="+ run smoothly in bazel"
4545
local unexpected="+ not run smoothly in bazel"
@@ -90,7 +90,7 @@ scala_specs2_junit_test_test_filter_exact_match(){
9090
local output=$(bazel test \
9191
--nocache_test_results \
9292
--test_output=streamed \
93-
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2AnotherTest#other specs2 tests should::run from another test$' \
93+
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2AnotherTest#other specs2 tests::run from another test$' \
9494
test:Specs2Tests)
9595
local expected="+ run from another test"
9696
local unexpected="+ run from another test 2"
@@ -112,7 +112,7 @@ scala_specs2_junit_test_test_filter_exact_match_unsafe_characters(){
112112
local output=$(bazel test \
113113
--nocache_test_results \
114114
--test_output=streamed \
115-
'--test_filter=scalarules.test.junit.specs2.JunitSpec2RegexTest#\Qtests with unsafe characters should::2 + 2 != 5\E$' \
115+
'--test_filter=scalarules.test.junit.specs2.JunitSpec2RegexTest#\Qtests with unsafe characters::2 + 2 != 5\E$' \
116116
test:Specs2Tests)
117117
local expected="+ 2 + 2 != 5"
118118
local unexpected="+ work escaped (with regex)"
@@ -134,7 +134,7 @@ scala_specs2_junit_test_test_filter_exact_match_escaped_and_sanitized(){
134134
local output=$(bazel test \
135135
--nocache_test_results \
136136
--test_output=streamed \
137-
'--test_filter=scalarules.test.junit.specs2.JunitSpec2RegexTest#\Qtests with unsafe characters should::work escaped [with regex]\E$' \
137+
'--test_filter=scalarules.test.junit.specs2.JunitSpec2RegexTest#\Qtests with unsafe characters::work escaped [with regex]\E$' \
138138
test:Specs2Tests)
139139
local expected="+ work escaped (with regex)"
140140
local unexpected="+ 2 + 2 != 5"
@@ -156,7 +156,7 @@ scala_specs2_junit_test_test_filter_match_multiple_methods(){
156156
local output=$(bazel test \
157157
--nocache_test_results \
158158
--test_output=streamed \
159-
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2AnotherTest#other specs2 tests should::(\Qrun from another test\E|\Qrun from another test 2\E)$' \
159+
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2AnotherTest#other specs2 tests::(\Qrun from another test\E|\Qrun from another test 2\E)$' \
160160
test:Specs2Tests)
161161
local expected=(
162162
"+ run from another test"
@@ -222,7 +222,7 @@ scala_specs2_all_tests_show_in_the_xml(){
222222
--test_output=streamed \
223223
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#' \
224224
test:Specs2Tests
225-
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)
225+
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)
226226
if [ $matches -eq 2 ]; then
227227
return 0
228228
else
@@ -236,9 +236,9 @@ scala_specs2_only_filtered_test_shows_in_the_xml(){
236236
bazel test \
237237
--nocache_test_results \
238238
--test_output=streamed \
239-
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#specs2 tests should::run smoothly in bazel$' \
239+
'--test_filter=scalarules.test.junit.specs2.JunitSpecs2Test#specs2 tests::run smoothly in bazel$' \
240240
test:Specs2Tests
241-
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)
241+
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)
242242
if [ $matches -eq 1 ]; then
243243
return 0
244244
else
@@ -253,10 +253,10 @@ scala_specs2_only_failed_test_shows_in_the_xml(){
253253
bazel test \
254254
--nocache_test_results \
255255
--test_output=streamed \
256-
'--test_filter=scalarules.test.junit.specs2.SuiteWithOneFailingTest#specs2 tests should::fail$' \
256+
'--test_filter=scalarules.test.junit.specs2.SuiteWithOneFailingTest#specs2 tests::fail$' \
257257
test_expect_failure/scala_junit_test:specs2_failing_test
258258
echo "got results"
259-
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)
259+
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)
260260
if [ $matches -eq 1 ]; then
261261
return 0
262262
else

test/src/main/scala/scalarules/test/junit/specs2/Specs2Tests.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import scalarules.test.junit.support.JUnitCompileTimeDep
55

66
class JunitSpecs2Test extends SpecWithJUnit {
77

8-
"specs2 tests" should {
8+
"specs2 tests" >> {
99
"run smoothly in bazel" in {
1010
println(JUnitCompileTimeDep.hello)
1111
success
@@ -19,7 +19,7 @@ class JunitSpecs2Test extends SpecWithJUnit {
1919

2020
class JunitSpecs2AnotherTest extends SpecWithJUnit {
2121

22-
"other specs2 tests" should {
22+
"other specs2 tests" >> {
2323
"run from another test" >> {
2424
println(JUnitCompileTimeDep.hello)
2525
success
@@ -30,7 +30,7 @@ class JunitSpecs2AnotherTest extends SpecWithJUnit {
3030
}
3131
}
3232

33-
"unrelated test" should {
33+
"unrelated test" >> {
3434
"not run" in {
3535
success
3636
}
@@ -39,7 +39,7 @@ class JunitSpecs2AnotherTest extends SpecWithJUnit {
3939

4040
class JunitSpec2RegexTest extends SpecWithJUnit {
4141

42-
"tests with unsafe characters" should {
42+
"tests with unsafe characters" >> {
4343
"2 + 2 != 5" in {
4444
2 + 2 must be_!=(5)
4545
}

test/src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package scalarules.test.location_expansion
33
import org.specs2.mutable.SpecWithJUnit
44
class LocationExpansionTest extends SpecWithJUnit {
55

6-
"tests" should {
6+
"tests" >> {
77
"support location expansion" >> {
88
sys.props.get("location.expanded") must beSome(contain("worker"))
99

test/src/main/scala/scalarules/test/resources/ScalaLibOnlyResourcesFilegroupTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.specs2.mutable.SpecWithJUnit
44

55
class ScalaLibOnlyResourcesFilegroupTest extends SpecWithJUnit {
66

7-
"Scala library with no srcs and only filegroup resources" should {
7+
"Scala library with no srcs and only filegroup resources" >> {
88
"allow to load resources" >> {
99
get("/resource.txt") must beEqualTo("I am a text resource!")
1010
get("/subdir/resource.txt") must beEqualTo("I am a text resource in a subdir!")

test/src/main/scala/scalarules/test/resources/ScalaLibOnlyResourcesTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.specs2.mutable.SpecWithJUnit
44

55
class ScalaLibOnlyResourcesTest extends SpecWithJUnit {
66

7-
"Scala library with no srcs and only resources" should {
7+
"Scala library with no srcs and only resources" >> {
88
"allow to load resources" >> {
99
get("/resource.txt") must beEqualTo("I am a text resource!")
1010
}

test/src/main/scala/scalarules/test/resources/ScalaLibResourcesFromExternalDepTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.specs2.mutable.SpecWithJUnit
44

55
class ScalaLibResourcesFromExternalDepTest extends SpecWithJUnit {
66

7-
"Scala library depending on resources from external resource-only jar" should {
7+
"Scala library depending on resources from external resource-only jar" >> {
88
"allow to load resources" >> {
99
get("/external/test_new_local_repo/resource.txt") must beEqualTo("A resource\n")
1010
}

test/src/main/scala/scalarules/test/resources/strip/ResourceStripPrefixTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.specs2.mutable.SpecificationWithJUnit
44

55
class ResourceStripPrefixTest extends SpecificationWithJUnit {
66

7-
"resource_strip_prefix" should {
7+
"resource_strip_prefix" >> {
88
"strip the prefix on nosrc jar" in {
99
val resource = getClass.getResourceAsStream("/nosrc_jar_resource.txt")
1010
resource must not beNull

test/src/main/scala/scalarules/test/scala_import/ScalaImportExposesFileJarsTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import com.lucidchart.relate.SqlRow
55

66
class ScalaImportExposesJarsTest extends SpecificationWithJUnit {
77

8-
"scala_import" should {
8+
"scala_import" >> {
99
"enable importing jars from files" in {
1010
println(classOf[SqlRow])
1111
success

0 commit comments

Comments
 (0)