@@ -4,6 +4,7 @@ package dotc
4
4
import core .* , Decorators .* , Symbols .*
5
5
import printing .Texts .*
6
6
7
+ import java .lang .System .{ lineSeparator => EOL }
7
8
import org .junit .Test
8
9
9
10
class TupleShowTests extends DottyTest :
@@ -51,22 +52,27 @@ class TupleShowTests extends DottyTest:
51
52
))
52
53
chkEq(exp, obt)
53
54
54
- @ Test def tup3_show10 = chkEq(" (Int,\n Long,\n Short)" , tup3.toText(ctx.printer).mkString(10 , false ))
55
+ @ Test def tup3_show10 = chkEq(" (Int,\n Long,\n Short)" .normEOL , tup3.toText(ctx.printer).mkString(10 , false ))
55
56
56
57
val res21 = """ |(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
57
- | Int, Long, Long, Long, Long, Long, Int)""" .stripMargin
58
+ | Int, Long, Long, Long, Long, Long, Int)""" .stripMargin.normEOL
58
59
59
60
val res22 = """ |(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
60
- | Int, Long, Long, Long, Long, Long, Int, Long)""" .stripMargin
61
+ | Int, Long, Long, Long, Long, Long, Int, Long)""" .stripMargin.normEOL
61
62
62
63
val res23 = """ |(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
63
- | Int, Long, Long, Long, Long, Long, Int, Long, Short)""" .stripMargin
64
+ | Int, Long, Long, Long, Long, Long, Int, Long, Short)""" .stripMargin.normEOL
64
65
65
66
val res24 = """ |(Int, Int, Int, Int, Int, Long, Long, Long, Long, Long, Int, Int, Int, Int,
66
- | Int, Long, Long, Long, Long, Long, Int, Long, Short, Short)""" .stripMargin
67
+ | Int, Long, Long, Long, Long, Long, Int, Long, Short, Short)""" .stripMargin.normEOL
67
68
68
69
def chkEq [A ](expected : A , obtained : A ) = assert(expected == obtained, diff(s " $expected" , s " $obtained" ))
69
70
71
+ /** On Windows the string literal in this test source file will be read with `\n` (b/c of "-encoding UTF8")
72
+ * but the compiler will correctly emit \r\n as the line separator.
73
+ * So we align the expected result to faithfully compare test results. */
74
+ extension (str : String ) def normEOL = if EOL == " \n " then str else str.replace(" \n " , EOL ).nn
75
+
70
76
def diff (exp : String , obt : String ) =
71
77
val min = math.min(exp.length, obt.length)
72
78
val pre =
0 commit comments