@@ -15,7 +15,7 @@ class LocationSpec extends org.specs2.mutable.Spec with TypedEqual:
15
15
given spec : LocationUnitSpecification = new LocationUnitSpecification (ee)
16
16
17
17
" for the first piece of text, with 'should'" >> {
18
- textAt(index = 0 ) === 16
18
+ textAt(index = 0 ) === lineNumber( 16 , 13 )
19
19
}
20
20
" for the first example, with 'in'" >> {
21
21
exampleAt(index = 0 ) === 14
@@ -24,13 +24,13 @@ class LocationSpec extends org.specs2.mutable.Spec with TypedEqual:
24
24
exampleAt(index = 1 ) === 15
25
25
}
26
26
" for the second piece of text, with '>>'" >> {
27
- textAt(index = 1 ) === 23
27
+ textAt(index = 1 ) === lineNumber( 23 , 18 )
28
28
}
29
29
" for the 3rd example, with '>>'" >> {
30
- exampleAt(index = 2 ) === 20
30
+ exampleAt(index = 2 ) === lineNumber( 20 , 19 )
31
31
}
32
32
" for the 4th example, with '>>'" >> {
33
- exampleAt(index = 3 ) === 22
33
+ exampleAt(index = 3 ) === lineNumber( 22 , 21 )
34
34
}
35
35
}
36
36
@@ -60,6 +60,10 @@ class LocationSpec extends org.specs2.mutable.Spec with TypedEqual:
60
60
}
61
61
}
62
62
63
+ def lineNumber (on322 : Int , onLater : Int ): Int =
64
+ val scalaVersion = org.specs2.BuildInfo .scalaVersion
65
+ if scalaVersion == " 3.2.2" then on322 else onLater
66
+
63
67
def textAt (index : Int )(using spec : WithFragments ) = fragmentLine(isText, index)
64
68
def exampleAt (index : Int )(using spec : WithFragments ) = fragmentLine(isExample, index)
65
69
def brAt (index : Int )(using spec : WithFragments ) = fragmentLine(isFormatting, index)
0 commit comments