You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2010/08/29 07:37:22 UTC

svn commit: r990497 - /buildr/trunk/spec/java/commands_spec.rb

Author: toulmean
Date: Sun Aug 29 05:37:22 2010
New Revision: 990497

URL: http://svn.apache.org/viewvc?rev=990497&view=rev
Log:
partial fix for BUILDR-483, with specs for javac

Modified:
    buildr/trunk/spec/java/commands_spec.rb

Modified: buildr/trunk/spec/java/commands_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/commands_spec.rb?rev=990497&r1=990496&r2=990497&view=diff
==============================================================================
--- buildr/trunk/spec/java/commands_spec.rb (original)
+++ buildr/trunk/spec/java/commands_spec.rb Sun Aug 29 05:37:22 2010
@@ -30,25 +30,35 @@ BUILD
     lambda { Java::Commands.java("org.apache.tools.ant.Main", :classpath => Buildr::Ant.dependencies) }.should_not show_info(/java/)
     lambda { Java::Commands.java("org.apache.tools.ant.Main", :classpath => Buildr::Ant.dependencies, :verbose => true) }.should show_info(/java/)
   end
-
+  
   describe "Java::Commands.javac" do
-
+    
+    it "should compile java" do
+      write "Foo.java", "public class Foo {}"
+      lambda { Java::Commands.javac("Foo.java") }.should change {File.exist?("Foo.class")}.to(true)
+    end
+      
     it 'should let the user specify an output directory' do
       write "Foo.java", "public class Foo {}"
-      mkdir_p "classes"
       lambda { Java::Commands.javac("Foo.java", :output => "classes") }.should change {File.exist?("classes/Foo.class")}.to(true)
     end
-
+    
     it "should let the user specify a different name" do
       write "Foo.java", "public class Foo {}"
       lambda { Java::Commands.javac("Foo.java", :name => "bar") }.should show_info("Compiling 1 source files in bar")
-
     end
-
-    it "should compile java" do
-      write "Foo.java", "public class Foo {}"
-      lambda { Java::Commands.javac("Foo.java") }.should change {File.exist?("Foo.class")}.to(true)
+    
+    it "should let the user specify a source path" do
+      write "ext/org/Bar.java", "package org; public class Bar {}"
+      write "Foo.java", "import org.Bar;\n public class Foo {}"
+      lambda { Java::Commands.javac("Foo.java", :sourcepath => File.expand_path("ext")) }.should change {File.exist?("Foo.class")}.to(true)
+    end
+    
+    it "should let the user specify a classpath" do
+      write "ext/org/Bar.java", "package org; public class Bar {}"
+      Java::Commands.javac("ext/org/Bar.java", :output => "lib")
+      write "Foo.java", "import org.Bar;\n public class Foo {}"
+      lambda { Java::Commands.javac("Foo.java", :classpath => File.expand_path("lib")) }.should change {File.exist?("Foo.class")}.to(true)
     end
   end
-
 end
\ No newline at end of file