diff options
author | Som Snytt <som.snytt@gmail.com> | 2013-07-03 02:06:25 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2013-07-04 07:55:15 -0700 |
commit | 596b85373b0203e7557f71e1bced980e277ec751 (patch) | |
tree | b379fbd87975937dd2d750bc276e2c65ec333d65 /test/files | |
parent | 4222849b14e64f668e7250bc2decef15eea5822a (diff) | |
download | scala-596b85373b0203e7557f71e1bced980e277ec751.tar.gz scala-596b85373b0203e7557f71e1bced980e277ec751.tar.bz2 scala-596b85373b0203e7557f71e1bced980e277ec751.zip |
SI-4594 Repl settings command
A settings command for the rest of us.
The usual command line options are used, except that boolean flags
are enabled with +flag and disabled with -flag.
```
scala> :settings +deprecation
scala> new BigInt(java.math.BigInteger.TEN) { }
<console>:8: warning: inheritance from class BigInt in package math is deprecated: This class will me made final.
new BigInt(java.math.BigInteger.TEN) { }
^
res0: BigInt = 10
scala> :settings -deprecation
scala> new BigInt(java.math.BigInteger.TEN) { }
res1: BigInt = 10
```
Multivalue "colon" options can be reset by supplying no values
after the colon. This behavior is different from the command line.
```
scala> 1 toString
warning: there were 1 feature warning(s); re-run with -feature for details
res0: String = 1
scala> :settings -language:postfixOps
scala> 1 toString
res1: String = 1
scala> :settings
-d = .
-encoding = UTF-8
-explaintypes = false
-language = List(postfixOps)
-nowarn = false
scala> :settings -language:
scala> :settings
-d = .
-encoding = UTF-8
-explaintypes = false
-language = List()
-nowarn = false
```
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t4594-repl-settings.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala new file mode 100644 index 0000000000..d2335460e5 --- /dev/null +++ b/test/files/run/t4594-repl-settings.scala @@ -0,0 +1,26 @@ + +import scala.tools.partest.SessionTest + +// Detected repl transcript paste: ctrl-D to finish. +object Test extends SessionTest { + def session = +""" |Type in expressions to have them evaluated. + |Type :help for more information. + | + |scala> @deprecated(message="Please don't do that.", since="Time began.") def depp = "john" + |depp: String + | + |scala> def a = depp + |warning: there were 1 deprecation warning(s); re-run with -deprecation for details + |a: String + | + |scala> :settings +deprecation + | + |scala> def b = depp + |<console>:8: warning: method depp is deprecated: Please don't do that. + | def b = depp + | ^ + |b: String + | + |scala> """ +} |