Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

This seems to work now.

  • Loading branch information...
commit 8c752064123b1435dd438b85fdcdf6dc2a9005cd 1 parent a1707d9
@devboy authored
Showing with 23 additions and 241 deletions.
  1. +5 −222 spec/as3/mxml_spec.rb
  2. +15 −17 spec/sandbox.rb
  3. +3 −2 spec/spec_helpers.rb
View
227 spec/as3/mxml_spec.rb
@@ -19,228 +19,11 @@
describe 'javac compiler' do
it 'should identify itself from source directories' do
- write 'src/main/java/com/example/Test.java', 'package com.example; class Test {}'
- define('foo').compile.compiler.should eql(:javac)
- end
-
- it 'should identify from source directories using custom layout' do
- write 'src/com/example/Code.java', 'package com.example; class Code {}'
- write 'testing/com/example/Test.java', 'package com.example; class Test {}'
- custom = Layout.new
- custom[:source, :main, :java] = 'src'
- custom[:source, :test, :java] = 'testing'
- define 'foo', :layout=>custom do
- compile.compiler.should eql(:javac)
- test.compile.compiler.should eql(:javac)
- end
- end
-
- it 'should identify from compile source directories' do
- write 'src/com/example/Code.java', 'package com.example; class Code {}'
- write 'testing/com/example/Test.java', 'package com.example; class Test {}'
- define 'foo' do
- lambda { compile.from 'src' }.should change { compile.compiler }.to(:javac)
- lambda { test.compile.from 'testing' }.should change { test.compile.compiler }.to(:javac)
- end
- end
-
- it 'should report the language as :java' do
- define('foo').compile.using(:javac).language.should eql(:java)
- end
-
- it 'should set the target directory to target/classes' do
- define 'foo' do
- lambda { compile.using(:javac) }.should change { compile.target.to_s }.to(File.expand_path('target/classes'))
- end
- end
-
- it 'should not override existing target directory' do
- define 'foo' do
- compile.into('classes')
- lambda { compile.using(:javac) }.should_not change { compile.target }
- end
- end
-
- it 'should not change existing list of sources' do
- define 'foo' do
- compile.from('sources')
- lambda { compile.using(:javac) }.should_not change { compile.sources }
- end
- end
-
- it 'should include classpath dependencies' do
- write 'src/dependency/Dependency.java', 'class Dependency {}'
- define 'dependency', :version=>'1.0' do
- compile.from('src/dependency').into('target/dependency')
- package(:jar)
- end
- write 'src/test/DependencyTest.java', 'class DependencyTest { Dependency _var; }'
- define('foo').compile.from('src/test').with(project('dependency')).invoke
- file('target/classes/DependencyTest.class').should exist
- end
-
- it 'should include tools.jar dependency' do
- write 'src/main/java/UseApt.java', <<-JAVA
- import com.sun.mirror.apt.AnnotationProcessor;
- public class UseApt { }
- JAVA
- define('foo').compile.invoke
- file('target/classes/UseApt.class').should exist
- end
-end
-
-
-describe 'javac compiler options' do
- def compile_task
- @compile_task ||= define('foo').compile.using(:javac)
- end
-
- def javac_args
- compile_task.instance_eval { @compiler }.send(:javac_args)
- end
-
- it 'should set warnings option to false by default' do
- compile_task.options.warnings.should be_false
- end
-
- it 'should set warnings option to true when running with --verbose option' do
- verbose true
- compile_task.options.warnings.should be_false
- end
-
- it 'should use -nowarn argument when warnings is false' do
- compile_task.using(:warnings=>false)
- javac_args.should include('-nowarn')
- end
-
- it 'should not use -nowarn argument when warnings is true' do
- compile_task.using(:warnings=>true)
- javac_args.should_not include('-nowarn')
- end
-
- it 'should not use -verbose argument by default' do
- javac_args.should_not include('-verbose')
- end
-
- it 'should use -verbose argument when running with --trace=javac option' do
- Buildr.application.options.trace_categories = [:javac]
- javac_args.should include('-verbose')
- end
-
- it 'should set debug option to true by default' do
- compile_task.options.debug.should be_true
- end
-
- it 'should set debug option to false based on Buildr.options' do
- Buildr.options.debug = false
- compile_task.options.debug.should be_false
- end
-
- it 'should set debug option to false based on debug environment variable' do
- ENV['debug'] = 'no'
- compile_task.options.debug.should be_false
- end
-
- it 'should set debug option to false based on DEBUG environment variable' do
- ENV['DEBUG'] = 'no'
- compile_task.options.debug.should be_false
- end
-
- it 'should use -g argument when debug option is true' do
- compile_task.using(:debug=>true)
- javac_args.should include('-g')
- end
-
- it 'should not use -g argument when debug option is false' do
- compile_task.using(:debug=>false)
- javac_args.should_not include('-g')
- end
-
- it 'should set deprecation option to false by default' do
- compile_task.options.deprecation.should be_false
- end
-
- it 'should use -deprecation argument when deprecation is true' do
- compile_task.using(:deprecation=>true)
- javac_args.should include('-deprecation')
- end
-
- it 'should not use -deprecation argument when deprecation is false' do
- compile_task.using(:deprecation=>false)
- javac_args.should_not include('-deprecation')
- end
-
- it 'should not set source option by default' do
- compile_task.options.source.should be_nil
- javac_args.should_not include('-source')
- end
-
- it 'should not set target option by default' do
- compile_task.options.target.should be_nil
- javac_args.should_not include('-target')
- end
-
- it 'should use -source nn argument if source option set' do
- compile_task.using(:source=>'1.5')
- javac_args.should include('-source', '1.5')
- end
-
- it 'should use -target nn argument if target option set' do
- compile_task.using(:target=>'1.5')
- javac_args.should include('-target', '1.5')
- end
-
- it 'should set lint option to false by default' do
- compile_task.options.lint.should be_false
- end
-
- it 'should use -lint argument if lint option is true' do
- compile_task.using(:lint=>true)
- javac_args.should include('-Xlint')
- end
-
- it 'should use -lint argument with value of option' do
- compile_task.using(:lint=>'all')
- javac_args.should include('-Xlint:all')
- end
-
- it 'should use -lint argument with value of option as array' do
- compile_task.using(:lint=>['path', 'serial'])
- javac_args.should include('-Xlint:path,serial')
- end
-
- it 'should not set other option by default' do
- compile_task.options.other.should be_nil
- end
-
- it 'should pass other argument if other option is string' do
- compile_task.using(:other=>'-Xprint')
- javac_args.should include('-Xprint')
- end
-
- it 'should pass other argument if other option is array' do
- compile_task.using(:other=>['-Xstdout', 'msgs'])
- javac_args.should include('-Xstdout', 'msgs')
- end
-
- it 'should complain about options it doesn\'t know' do
- write 'source/Test.java', 'class Test {}'
- compile_task.using(:unknown=>'option')
- lambda { compile_task.from('source').invoke }.should raise_error(ArgumentError, /no such option/i)
- end
-
- it 'should inherit options from parent' do
- define 'foo' do
- compile.using(:warnings=>true, :debug=>true, :deprecation=>true, :source=>'1.5', :target=>'1.4')
- define 'bar' do
- compile.using(:javac)
- compile.options.warnings.should be_true
- compile.options.debug.should be_true
- compile.options.deprecation.should be_true
- compile.options.source.should eql('1.5')
- compile.options.target.should eql('1.4')
- end
- end
+ write 'src/main/as3/com/example/Test.java', 'package com.example; class Test {}'
+ #define('foo').compile.compiler.should eql(:javac)
+ define('foo') do
+ compile.using :mxmlc
+ end.compile.compiler.should eql(:mxmlc)
end
after do
View
32 spec/sandbox.rb
@@ -17,8 +17,6 @@
# The local repository we use for testing is void of any artifacts, which will break given
# that the code requires several artifacts. So we establish them first using the real local
# repository and cache these across test cases.
-require 'buildr'
-
Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
repositories.remote << 'http://repo1.maven.org/maven2'
repositories.remote << 'http://scala-tools.org/repo-releases'
@@ -36,21 +34,21 @@
#require 'buildr/bnd'
#require 'buildr/jaxb_xjc'
-#Java.load # Anything added to the classpath.
-#artifacts(
-# TestFramework.frameworks.map(&:dependencies).flatten,
-# JUnit.ant_taskdef,
-# Buildr::Groovy.dependencies,
-# Buildr::JaxbXjc.dependencies,
-# Buildr::Bnd.dependencies,
-# Buildr::Scala::Scalac.dependencies,
-# Buildr::Scala::Specs.dependencies,
-# Buildr::Shell::BeanShell.artifact,
-# Buildr::Clojure.dependencies
-#).each do |path|
-# file(path).invoke
-#end
-
+Java.load # Anything added to the classpath.
+artifacts(
+#TestFramework.frameworks.map(&:dependencies).flatten,
+ JUnit.ant_taskdef
+ #Buildr::Groovy.dependencies,
+ #Buildr::JaxbXjc.dependencies,
+ #Buildr::Bnd.dependencies,
+ #Buildr::Scala::Scalac.dependencies,
+ #Buildr::Scala::Specs.dependencies,
+ #Buildr::Shell::BeanShell.artifact,
+ #Buildr::Clojure.dependencies
+).each do |path|
+ file(path).invoke
+end
+#
ENV['HOME'] = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'home'))
mkpath ENV['HOME']
View
5 spec/spec_helpers.rb
@@ -37,7 +37,8 @@
def autoload(symbol, path)
require path
end
- #require 'buildr'
+ require 'buildr'
+ require 'buildr/as3'
# load ecj
#require 'buildr/java/ecj'
#Make ecj appear as a compiler that doesn't apply:
@@ -284,7 +285,7 @@ def point_to_path(path)
AbsolutePathMatcher.new(path)
end
- #require "rspec/matchers"
+
# Value covered by range. For example:
# (1..5).should cover(3)
RSpec::Matchers.define :cover do |actual|
Please sign in to comment.
Something went wrong with that request. Please try again.