diff options
author | wilhelm bierbaum <wilhelm@twitter.com> | 2011-04-29 13:22:39 -0700 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-11-07 02:08:38 -0500 |
commit | 1f9ff6569de3993cb36629f1b8983a65452690a3 (patch) | |
tree | f1f2ff14a27b8c05a4025b6c79a35f007df8134c /libraries/eval/test | |
parent | 46ef4635b75aa6735b72b52508637265e4c0ed70 (diff) | |
download | cbt-1f9ff6569de3993cb36629f1b8983a65452690a3.tar.gz cbt-1f9ff6569de3993cb36629f1b8983a65452690a3.tar.bz2 cbt-1f9ff6569de3993cb36629f1b8983a65452690a3.zip |
[split] Squashed commit of the following:
commit ead2b12ebf8c8c9b0d191235119cea7be01a22e8
Author: wilhelm bierbaum <wilhelm@twitter.com>
Date: Fri Apr 29 13:20:37 2011 -0700
use StreamIO
commit 23a12f4b8c40facaad4a81a363d02a3914897267
Merge: 59da183 90a1dd0
Author: wilhelm bierbaum <wilhelm@twitter.com>
Date: Fri Apr 29 13:20:16 2011 -0700
Merge remote-tracking branch 'origin/master' into eval_include_directives
commit 59da18308707f6d285e4b65e7e7a33aa62af77ab
Merge: 4296624 f6ead9a
Author: wilhelm bierbaum <wilhelm@twitter.com>
Date: Thu Apr 28 23:58:18 2011 -0700
Merge remote-tracking branch 'origin/master' into eval_include_directives
Conflicts:
util/util-eval/src/test/scala/com/twitter/util/EvaluatorSpec.scala
commit 42966245dc24d2026a8b3955e3c313445a93ac3e
Merge: a0aa60e d98d9c9
Author: Wilhelm Bierbaum <wilhelm@twitter.com>
Date: Tue Apr 19 20:05:57 2011 -0700
Merge branch 'master' into eval_include_directives
commit a0aa60e80df3bd0312f3349eed61e997109fa510
Author: Wilhelm Bierbaum <wilhelm@twitter.com>
Date: Tue Apr 19 20:05:46 2011 -0700
revert inadvertent changes
commit 931be4dce6dd82ec2ef8d09f8576c9a27f50640a
Author: Wilhelm Bierbaum <wilhelm@twitter.com>
Date: Tue Apr 19 17:10:19 2011 -0700
introduce a preprocessor that can #include files from the filesystem (by default rooted in ./ or ./config) or the classpath into the Eval-based config compiler
Diffstat (limited to 'libraries/eval/test')
-rw-r--r-- | libraries/eval/test/EvalTest.scala | 13 | ||||
-rw-r--r-- | libraries/eval/test/resources/DerivedWithInclude.scala | 3 | ||||
-rw-r--r-- | libraries/eval/test/resources/HelloJoe.scala | 3 | ||||
-rw-r--r-- | libraries/eval/test/resources/RubyInclude.scala | 3 |
4 files changed, 22 insertions, 0 deletions
diff --git a/libraries/eval/test/EvalTest.scala b/libraries/eval/test/EvalTest.scala index 3541381..c16de43 100644 --- a/libraries/eval/test/EvalTest.scala +++ b/libraries/eval/test/EvalTest.scala @@ -42,5 +42,18 @@ object EvalSpec extends Specification { (new Eval).check("23") mustEqual () (new Eval).check("invalid") must throwA[Eval.CompilerException] } + + "#include" in { + val derived = Eval[() => String]( + TempFile.fromResourcePath("/Base.scala"), + TempFile.fromResourcePath("/DerivedWithInclude.scala")) + derived() mustEqual "hello" + derived.toString mustEqual "hello, joe" + } + + "throws a compilation error when Ruby is #included" in { + Eval[() => String]( + TempFile.fromResourcePath("RubyInclude.scala")) must throwA[Throwable] + } } } diff --git a/libraries/eval/test/resources/DerivedWithInclude.scala b/libraries/eval/test/resources/DerivedWithInclude.scala new file mode 100644 index 0000000..476d60e --- /dev/null +++ b/libraries/eval/test/resources/DerivedWithInclude.scala @@ -0,0 +1,3 @@ +new Base { +#include HelloJoe.scala +} diff --git a/libraries/eval/test/resources/HelloJoe.scala b/libraries/eval/test/resources/HelloJoe.scala new file mode 100644 index 0000000..c6ea42e --- /dev/null +++ b/libraries/eval/test/resources/HelloJoe.scala @@ -0,0 +1,3 @@ +/* real-time declarative programming now */ +override def toString = "hello, joe" + diff --git a/libraries/eval/test/resources/RubyInclude.scala b/libraries/eval/test/resources/RubyInclude.scala new file mode 100644 index 0000000..a763d52 --- /dev/null +++ b/libraries/eval/test/resources/RubyInclude.scala @@ -0,0 +1,3 @@ +object CodeThatIncludesSomeRuby { +#include hello.rb +} |