Skip to content

Instantly share code, notes, and snippets.

@clairvy
Created February 18, 2010 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clairvy/307561 to your computer and use it in GitHub Desktop.
Save clairvy/307561 to your computer and use it in GitHub Desktop.
public class AA {
public int func(int x) {
return x + 2;
}
}
do : build
scala test.scala
echo :l test.scala | scala
build: AA.class
AA.class : AA.java
javac $^
clean :
$(RM) $(RMF) *.class
test :
prove ./test.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 2;
my $expect = <<"EOL";
12
EOL
is(`scala test.scala`, $expect);
{
my $ret = `echo :l test.scala | scala`;
$ret =~ s/\A.*aa:[^\n]+[\n]+//ms;
$ret =~ s/scala> //ms;
chomp($ret);
is($ret, $expect);
}
val aa = new AA;
println(aa.func(10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment