You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2008/10/12 09:36:53 UTC

svn commit: r703768 - /incubator/buildr/trunk/spec/ide/eclipse_spec.rb

Author: boisvert
Date: Sun Oct 12 00:36:52 2008
New Revision: 703768

URL: http://svn.apache.org/viewvc?rev=703768&view=rev
Log:
Add some specs for java .project files

Modified:
    incubator/buildr/trunk/spec/ide/eclipse_spec.rb

Modified: incubator/buildr/trunk/spec/ide/eclipse_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/ide/eclipse_spec.rb?rev=703768&r1=703767&r2=703768&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/ide/eclipse_spec.rb (original)
+++ incubator/buildr/trunk/spec/ide/eclipse_spec.rb Sun Oct 12 00:36:52 2008
@@ -52,22 +52,57 @@
   include EclipseHelper
   
   describe "eclipse's .project file" do
+
+    JAVA_CONTAINER  = 'org.eclipse.jdt.launching.JRE_CONTAINER'
+    SCALA_CONTAINER = 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER'
+
+    SCALA_NATURE = 'ch.epfl.lamp.sdt.core.scalanature'
+    JAVA_NATURE  = 'org.eclipse.jdt.core.javanature'
     
-    describe 'scala project' do
-      
-      SCALA_NATURE = 'ch.epfl.lamp.sdt.core.scalanature'
-      JAVA_NATURE  = 'org.eclipse.jdt.core.javanature'
+    SCALA_BUILDER = 'ch.epfl.lamp.sdt.core.scalabuilder'
+    JAVA_BUILDER  = 'org.eclipse.jdt.core.javabuilder'
+
+    def project_natures
+      project_xml_elements.collect("natures/nature") { |n| n.text }
+    end
+    
+    def build_commands
+      project_xml_elements.collect("buildSpec/buildCommand/name") { |n| n.text }
+    end
+    
+    describe 'java project' do
+      before do
+        write 'buildfile'
+        write 'src/main/java/Main.java'
+      end
       
-      SCALA_BUILDER = 'ch.epfl.lamp.sdt.core.scalabuilder'
-      JAVA_BUILDER  = 'org.eclipse.jdt.core.javabuilder'
+      it 'should have Java nature' do
+        define('foo')
+        project_natures.should include(JAVA_NATURE)
+      end
       
-      def project_natures
-        project_xml_elements.collect("natures/nature") { |n| n.text }
+      it 'should have Java build command' do
+        define('foo')
+        build_commands.should include(JAVA_BUILDER)
       end
+    end
+    
+    describe 'nested java project' do
       
-      def build_commands
-        project_xml_elements.collect("buildSpec/buildCommand/name") { |n| n.text }
+      it 'should have name corresponding to its project definition' do
+        mkdir 'foo'
+        define('myproject') {
+          project.version = '1.0'
+          define('foo') { compile.using(:javac); package :jar }
+        }
+        task('eclipse').invoke
+        REXML::Document.new(File.open(File.join('foo', '.project'))).root.
+          elements.collect("name") { |e| e.text }.should == ['myproject-foo']
       end
+
+    end
+    
+    describe 'scala project' do
       
       before do
         write 'buildfile'
@@ -92,10 +127,7 @@
   describe "eclipse's .classpath file" do
     
     describe 'scala project' do
-      
-      SCALA_CONTAINER = 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER'
-      JAVA_CONTAINER  = 'org.eclipse.jdt.launching.JRE_CONTAINER'
-      
+
       def classpath_containers attribute='path'
         classpath_xml_elements.collect("classpathentry[@kind='con']") { |n| n.attributes[attribute] }
       end
@@ -105,7 +137,7 @@
         write 'src/main/scala/Main.scala'
       end
       
-      it 'should have SCALA_CONTAINER before JRE_CONTAINER' do
+      it 'should have SCALA_CONTAINER before JAVA_CONTAINER' do
         define('foo')
         classpath_containers.should include(SCALA_CONTAINER)
         classpath_containers.should include(JAVA_CONTAINER)