diff options
author | Som Snytt <som.snytt@gmail.com> | 2014-02-11 13:53:32 -0800 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2014-02-11 13:53:32 -0800 |
commit | ff4cfd575a9b731adc60582de447fafb5303eb49 (patch) | |
tree | 5a01de0954e811fd7e012f3f902c74c540837b8d /test | |
parent | d4f5abf9002fd617e871d1f20fdcf531b38b26e1 (diff) | |
download | scala-ff4cfd575a9b731adc60582de447fafb5303eb49.tar.gz scala-ff4cfd575a9b731adc60582de447fafb5303eb49.tar.bz2 scala-ff4cfd575a9b731adc60582de447fafb5303eb49.zip |
SI-8266 Deprecate octal escapes in f-interpolator
Also turns the f-interpolator into a migration
assistant by suggesting alternatives for the
standard escapes.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t8266-invalid-interp.check | 10 | ||||
-rw-r--r-- | test/files/neg/t8266-invalid-interp.scala | 9 | ||||
-rw-r--r-- | test/files/run/t8266-octal-interp.check | 30 | ||||
-rw-r--r-- | test/files/run/t8266-octal-interp.flags | 1 | ||||
-rw-r--r-- | test/files/run/t8266-octal-interp.scala | 16 |
5 files changed, 66 insertions, 0 deletions
diff --git a/test/files/neg/t8266-invalid-interp.check b/test/files/neg/t8266-invalid-interp.check new file mode 100644 index 0000000000..70dd4081b0 --- /dev/null +++ b/test/files/neg/t8266-invalid-interp.check @@ -0,0 +1,10 @@ +t8266-invalid-interp.scala:4: error: Trailing '\' escapes nothing. + f"a\", + ^ +t8266-invalid-interp.scala:5: error: invalid escape character at index 1 in "a\xc" + f"a\xc", + ^ +t8266-invalid-interp.scala:7: error: invalid escape character at index 1 in "a\vc" + f"a\vc" + ^ +three errors found diff --git a/test/files/neg/t8266-invalid-interp.scala b/test/files/neg/t8266-invalid-interp.scala new file mode 100644 index 0000000000..4b26546880 --- /dev/null +++ b/test/files/neg/t8266-invalid-interp.scala @@ -0,0 +1,9 @@ + +trait X { + def f = Seq( + f"a\", + f"a\xc", + // following could suggest \u000b for vertical tab, similar for \a alert + f"a\vc" + ) +} diff --git a/test/files/run/t8266-octal-interp.check b/test/files/run/t8266-octal-interp.check new file mode 100644 index 0000000000..6e9454119b --- /dev/null +++ b/test/files/run/t8266-octal-interp.check @@ -0,0 +1,30 @@ +t8266-octal-interp.scala:4: warning: Octal escape literals are deprecated, use \b instead. + f"a\10c", + ^ +t8266-octal-interp.scala:5: warning: Octal escape literals are deprecated, use \t instead. + f"a\11c", + ^ +t8266-octal-interp.scala:6: warning: Octal escape literals are deprecated, use \n instead. + f"a\12c", + ^ +t8266-octal-interp.scala:7: warning: Octal escape literals are deprecated, use \r instead. + f"a\15c", + ^ +t8266-octal-interp.scala:8: warning: Octal escape literals are deprecated, use \u0022 instead. + f"a\42c", + ^ +t8266-octal-interp.scala:9: warning: Octal escape literals are deprecated, use \\ instead. + f"a\134c", + ^ +t8266-octal-interp.scala:10: warning: Octal escape literals are deprecated, use \u0069 instead. + f"a\15151515c" + ^ +ac +a c +a +c +a +c +a"c +a\c +ai51515c diff --git a/test/files/run/t8266-octal-interp.flags b/test/files/run/t8266-octal-interp.flags new file mode 100644 index 0000000000..dcc59ebe32 --- /dev/null +++ b/test/files/run/t8266-octal-interp.flags @@ -0,0 +1 @@ +-deprecation diff --git a/test/files/run/t8266-octal-interp.scala b/test/files/run/t8266-octal-interp.scala new file mode 100644 index 0000000000..f85ae0367d --- /dev/null +++ b/test/files/run/t8266-octal-interp.scala @@ -0,0 +1,16 @@ + +trait X { + def f = Seq( + f"a\10c", + f"a\11c", + f"a\12c", + f"a\15c", + f"a\42c", + f"a\134c", + f"a\15151515c" + ) +} + +object Test extends App with X { + f foreach println +} |