asunit4 4.2.1.pre → 4.2.2.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +6 -2
- data/asunit4.gemspec +2 -2
- data/bin/AsUnit-4.2.1.pre.swc +0 -0
- data/bin/AsUnit-4.2.2.pre.swc +0 -0
- data/bin/AsUnitRunner.swf +0 -0
- data/rakefile.rb +57 -28
- data/sprout/lib/asunit4/suite_class_generator.rb +17 -0
- data/sprout/lib/asunit4/templates/AsUnit4SuiteClass.as +18 -0
- data/sprout/lib/asunit4/templates/AsUnit4TestClass.as +33 -0
- data/sprout/lib/asunit4/test_class_generator.rb +15 -0
- data/sprout/lib/asunit4.rb +23 -0
- data/sprout/test/unit/test_class_generator_test.rb +51 -0
- data/sprout/test/unit/test_helper.rb +17 -0
- data/src/asunit/runners/TestRunner.as +3 -3
- data/test/asunit/core/AsUnitCoreTest.as +1 -1
- metadata +13 -7
- data/asunit4.rb +0 -16
- data/bin/AsUnit-4.1.pre.swc +0 -0
- data/script/generate +0 -21
data/Gemfile
CHANGED
data/asunit4.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
-
require File.dirname(__FILE__)
|
3
|
+
require File.join(File.dirname(__FILE__), 'sprout', 'lib', 'asunit4')
|
4
4
|
require 'rake'
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.description = "AsUnit is the only ActionScript unit test framework that support every development and runtime environment that is currently available. This includes Flex 2, 3, 4, AIR 1 and 2, Flash Lite, and of course the Flash Authoring tool"
|
15
15
|
s.rubyforge_project = "sprout"
|
16
16
|
s.required_rubygems_version = ">= 1.3.6"
|
17
|
-
s.require_path = "
|
17
|
+
s.require_path = "sprout/lib"
|
18
18
|
s.files = FileList["**/*"].exclude /docs|.DS_Store|generated|.svn|.git|airglobal.swc|airframework.swc/
|
19
19
|
end
|
20
20
|
|
Binary file
|
Binary file
|
data/bin/AsUnitRunner.swf
CHANGED
Binary file
|
data/rakefile.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
require 'bundler'
|
2
|
-
Bundler.
|
2
|
+
Bundler.require
|
3
3
|
|
4
|
-
require '
|
5
|
-
sprout '
|
6
|
-
|
7
|
-
require File.dirname(__FILE__) + '/asunit4'
|
4
|
+
require 'rake/clean'
|
5
|
+
require File.join(File.dirname(__FILE__), 'sprout', 'lib', 'asunit4')
|
8
6
|
|
9
7
|
test_input = "AsUnitRunner"
|
10
8
|
|
@@ -40,7 +38,7 @@ end
|
|
40
38
|
# Configure a Test Build:
|
41
39
|
|
42
40
|
def configure_test_task(t)
|
43
|
-
t.default_size = '1000
|
41
|
+
t.default_size = '1000,600'
|
44
42
|
t.source_path << 'src'
|
45
43
|
t.library_path << 'lib/Reflection.swc'
|
46
44
|
t.debug = true
|
@@ -54,28 +52,28 @@ end
|
|
54
52
|
desc "Compile the ActionScript test harness"
|
55
53
|
mxmlc "bin/#{test_input}.swf" do |t|
|
56
54
|
t.input = "test/AsUnitRunner.as"
|
57
|
-
t.
|
55
|
+
t.pkg_name = 'flex4'
|
58
56
|
configure_test_task t
|
59
57
|
end
|
60
58
|
|
61
59
|
desc "Compile the Flex 3 test harness"
|
62
60
|
mxmlc "bin/Flex3#{test_input}.swf" do |t|
|
63
61
|
t.input = "test/Flex3Runner.mxml"
|
64
|
-
t.
|
62
|
+
t.pkg_name = 'flex3'
|
65
63
|
configure_test_task t
|
66
64
|
end
|
67
65
|
|
68
66
|
desc "Compile the Flex 4 test harness"
|
69
67
|
mxmlc "bin/Flex4#{test_input}.swf" do |t|
|
70
68
|
t.input = "test/Flex4Runner.mxml"
|
71
|
-
t.
|
69
|
+
t.pkg_name = 'flex4'
|
72
70
|
configure_test_task t
|
73
71
|
end
|
74
72
|
|
75
73
|
desc "Compile the AIR 2 test harness"
|
76
74
|
mxmlc "bin/AIR2#{test_input}.swf" do |t|
|
77
75
|
t.input = "air/AIR2Runner.mxml"
|
78
|
-
t.
|
76
|
+
t.pkg_name = 'flex4'
|
79
77
|
t.source_path << 'air'
|
80
78
|
t.source_path << 'test'
|
81
79
|
t.library_path << 'lib/airglobal.swc'
|
@@ -95,12 +93,17 @@ flashplayer :test_flex3 => "bin/Flex3#{test_input}.swf"
|
|
95
93
|
desc "Compile and run the Flex 4 Harness"
|
96
94
|
flashplayer :test_flex4 => "bin/Flex4#{test_input}.swf"
|
97
95
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
96
|
+
# TODO: Reactivate this once the new sprout harness
|
97
|
+
# support adl / adt
|
98
|
+
|
99
|
+
task :test_air2
|
100
|
+
|
101
|
+
#desc "Compile and run the AIR 2 Harness"
|
102
|
+
#adl :test_air2 => "bin/AIR2#{test_input}.swf" do |t|
|
103
|
+
#t.pkg_name = 'flex4'
|
104
|
+
#t.root_directory = Dir.pwd
|
105
|
+
#t.application_descriptor = "air/AIR2RunnerDescriptor.xml"
|
106
|
+
#end
|
104
107
|
|
105
108
|
desc "Compile and run the ActionScript 3 test harness"
|
106
109
|
task :test => :test_as3
|
@@ -108,11 +111,25 @@ task :test => :test_as3
|
|
108
111
|
desc "Compile and run test harnesses for all supported environments"
|
109
112
|
task :test_all => [:test_as3, :test_flex3, :test_flex4, :test_air2]
|
110
113
|
|
114
|
+
##########################################
|
115
|
+
# Run the Sprout Ruby tests
|
116
|
+
|
117
|
+
require 'rake/testtask'
|
118
|
+
|
119
|
+
namespace :sprout do
|
120
|
+
desc "Run the Sprout Generator tests"
|
121
|
+
Rake::TestTask.new(:test) do |t|
|
122
|
+
t.libs << "test/unit"
|
123
|
+
t.test_files = FileList["sprout/test/unit/*_test.rb"]
|
124
|
+
t.verbose = true
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
111
128
|
##########################################
|
112
129
|
# Compile the SWC
|
113
130
|
|
114
|
-
|
115
|
-
t.
|
131
|
+
compc "bin/AsUnit-#{AsUnit::VERSION}.swc" do |t|
|
132
|
+
t.pkg_name = 'flex4'
|
116
133
|
t.include_sources << 'src'
|
117
134
|
t.source_path << 'src'
|
118
135
|
t.library_path << 'lib/Reflection.swc'
|
@@ -120,25 +137,34 @@ def configure_swc_task(t)
|
|
120
137
|
apply_as3_meta_data_args(t)
|
121
138
|
end
|
122
139
|
|
123
|
-
|
124
|
-
|
140
|
+
task :swc => "bin/AsUnit-#{AsUnit::VERSION}.swc"
|
141
|
+
|
142
|
+
##########################################
|
143
|
+
# Compile the Gem
|
144
|
+
|
145
|
+
file "bin/asunit4-#{AsUnit::VERSION}.gem" do
|
146
|
+
sh "gem build asunit4.gemspec"
|
147
|
+
mv "asunit4-#{AsUnit::VERSION}.gem", "bin/"
|
125
148
|
end
|
126
149
|
|
127
|
-
|
150
|
+
CLEAN.add("bin/*.gem")
|
151
|
+
|
152
|
+
desc "Build the rubygem"
|
153
|
+
task :gem => [:clean, :swc, "bin/asunit4-#{AsUnit::VERSION}.gem"]
|
128
154
|
|
129
155
|
##########################################
|
130
156
|
# Generate documentation
|
131
157
|
|
132
|
-
desc "Generate documentation"
|
133
|
-
asdoc 'doc' do |t|
|
134
|
-
t.appended_args = '-examples-path=examples'
|
135
|
-
t.source_path << 'src'
|
136
|
-
t.doc_classes << 'AsUnit'
|
137
|
-
t.library_path << 'lib/Reflection.swc'
|
158
|
+
#desc "Generate documentation"
|
159
|
+
#asdoc 'doc' do |t|
|
160
|
+
#t.appended_args = '-examples-path=examples'
|
161
|
+
#t.source_path << 'src'
|
162
|
+
#t.doc_classes << 'AsUnit'
|
163
|
+
#t.library_path << 'lib/Reflection.swc'
|
138
164
|
|
139
165
|
# Not on asdoc?
|
140
166
|
#t.static_link_runtime_shared_libraries = true
|
141
|
-
end
|
167
|
+
#end
|
142
168
|
|
143
169
|
##########################################
|
144
170
|
# Package framework ZIPs
|
@@ -151,6 +177,8 @@ end
|
|
151
177
|
|
152
178
|
CLEAN.add '*.gem'
|
153
179
|
|
180
|
+
=begin
|
181
|
+
# TODO: Add back when zip task is working
|
154
182
|
archive = "AsUnit-#{AsUnit::VERSION}.zip"
|
155
183
|
|
156
184
|
zip archive do |t|
|
@@ -161,6 +189,7 @@ CLEAN.add '*.zip'
|
|
161
189
|
|
162
190
|
desc "Create zip archives"
|
163
191
|
task :zip => [:clean, :test_all, archive]
|
192
|
+
=end
|
164
193
|
|
165
194
|
##########################################
|
166
195
|
# Set up task wrappers
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module AsUnit4
|
2
|
+
class SuiteClassGenerator < FlashSDK::ClassGenerator
|
3
|
+
include FlashSDK::FlashHelper
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
self.input = 'AllTests.as'
|
8
|
+
end
|
9
|
+
|
10
|
+
def manifest
|
11
|
+
directory test do
|
12
|
+
template input, 'AsUnit4SuiteClass.as'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
package {
|
2
|
+
/**
|
3
|
+
* This file has been automatically created using
|
4
|
+
* #!/usr/bin/ruby script/generate suite
|
5
|
+
* If you modify it and run this script, your
|
6
|
+
* modifications will be lost!
|
7
|
+
*/
|
8
|
+
<% test_case_classes.each do |test_case| %>import <%= test_case %>;
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
[Suite]
|
12
|
+
public class AllTests {
|
13
|
+
<% test_case_classes.each do |test_case| %>public var <%= test_case.gsub('.', '_') %>:<%= test_case %>;
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
package <%= package_name %> {
|
2
|
+
|
3
|
+
import asunit.asserts.*;
|
4
|
+
import asunit.framework.IAsync;
|
5
|
+
import flash.display.Sprite;
|
6
|
+
|
7
|
+
public class <%= test_class_name %> {
|
8
|
+
|
9
|
+
[Inject]
|
10
|
+
public var async:IAsync;
|
11
|
+
|
12
|
+
[Inject]
|
13
|
+
public var context:Sprite;
|
14
|
+
|
15
|
+
private var <%= instance_name %>:<%= class_name %>;
|
16
|
+
|
17
|
+
[Before]
|
18
|
+
public function setUp():void {
|
19
|
+
<%= instance_name %> = new <%= class_name %>();
|
20
|
+
}
|
21
|
+
|
22
|
+
[After]
|
23
|
+
public function tearDown():void {
|
24
|
+
<%= instance_name %> = null;
|
25
|
+
}
|
26
|
+
|
27
|
+
[Test]
|
28
|
+
public function shouldBeInstantiated():void {
|
29
|
+
assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
module AsUnit4
|
3
|
+
class TestClassGenerator < FlashSDK::ClassGenerator
|
4
|
+
|
5
|
+
def manifest
|
6
|
+
directory test_class_directory do
|
7
|
+
template "#{test_class_name}.as", 'AsUnit4TestClass.as'
|
8
|
+
end
|
9
|
+
|
10
|
+
generator :suite_class, {:input => 'AllTests.as'}
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'flashsdk'
|
2
|
+
|
3
|
+
$:.unshift File.dirname(__FILE__)
|
4
|
+
|
5
|
+
module AsUnit
|
6
|
+
NAME = 'asunit4'
|
7
|
+
VERSION = '4.2.2.pre'
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'asunit4/test_class_generator'
|
11
|
+
require 'asunit4/suite_class_generator'
|
12
|
+
|
13
|
+
Sprout::Specification.new do |s|
|
14
|
+
s.name = AsUnit::NAME
|
15
|
+
s.version = AsUnit::VERSION
|
16
|
+
s.add_file_target do |f|
|
17
|
+
f.add_library :swc, File.join('..', '..', 'bin', "AsUnit-#{AsUnit::VERSION}.swc")
|
18
|
+
# Removed the src compilation for now, b/c it requires additional compiler
|
19
|
+
# configuration - like keep-as3-metadata...
|
20
|
+
#f.add_library :src, [File.join(path, 'src'), File.join(path, 'vendor/as3reflection')]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_helper")
|
2
|
+
|
3
|
+
class TestClassGeneratorTest < Test::Unit::TestCase
|
4
|
+
include SproutTestCase
|
5
|
+
|
6
|
+
context "a new test class generator" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@fixtures = File.join('sprout', 'test', 'fixtures')
|
10
|
+
@temp = File.join(fixtures, 'tmp')
|
11
|
+
FileUtils.mkdir_p @temp
|
12
|
+
|
13
|
+
@generator = AsUnit4::TestClassGenerator.new
|
14
|
+
@generator.path = @temp
|
15
|
+
@generator.logger = StringIO.new
|
16
|
+
end
|
17
|
+
|
18
|
+
teardown do
|
19
|
+
remove_file @temp
|
20
|
+
end
|
21
|
+
|
22
|
+
should "work with a simple class" do
|
23
|
+
@generator.input = 'utils.MathUtilTest'
|
24
|
+
@generator.execute
|
25
|
+
|
26
|
+
assert_file File.join(@temp, 'test', 'utils', 'MathUtilTest.as') do |content|
|
27
|
+
assert_matches /class MathUtilTest \{/, content
|
28
|
+
assert_matches /private var .*:MathUtil;/, content
|
29
|
+
assert_matches /new MathUtil\(\);/, content
|
30
|
+
end
|
31
|
+
assert_file File.join(@temp, 'test', 'AllTests.as') do |content|
|
32
|
+
assert_matches /import utils.MathUtilTest;/, content
|
33
|
+
assert_matches /public var utils_MathUtilTest:utils\.MathUtilTest;/, content
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
should "work without test suffix in the request" do
|
38
|
+
@generator.input = 'utils.MathUtil'
|
39
|
+
@generator.execute
|
40
|
+
assert_file File.join(@temp, 'test', 'utils', 'MathUtilTest.as') do |content|
|
41
|
+
assert_matches /class MathUtilTest \{/, content
|
42
|
+
assert_matches /private var instance:MathUtil/, content
|
43
|
+
end
|
44
|
+
assert_file File.join(@temp, 'test', 'AllTests.as') do |content|
|
45
|
+
assert_matches /import utils.MathUtilTest/, content
|
46
|
+
assert_matches /public var utils_MathUtilTest:utils\.MathUtilTest;/, content
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler"
|
3
|
+
|
4
|
+
Bundler.require :default, :development
|
5
|
+
|
6
|
+
# These require statments *must* be in this order:
|
7
|
+
# http://bit.ly/bCC0Ew
|
8
|
+
# Somewhat surprised they're not being required by Bundler...
|
9
|
+
require 'shoulda'
|
10
|
+
require 'mocha'
|
11
|
+
require 'test/unit'
|
12
|
+
|
13
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'asunit4')
|
14
|
+
$:.unshift File.dirname(__FILE__)
|
15
|
+
|
16
|
+
require 'sprout/test/sprout_test_case'
|
17
|
+
|
@@ -205,12 +205,12 @@ package asunit.runners {
|
|
205
205
|
}
|
206
206
|
|
207
207
|
// Calling synchronously is faster but keeps adding to the call stack.
|
208
|
-
|
208
|
+
runNextMethod();
|
209
209
|
|
210
210
|
// green thread for runNextMethod()
|
211
211
|
// This runs much slower in Flash Player 10.1.
|
212
|
-
timer.reset();
|
213
|
-
timer.start();
|
212
|
+
//timer.reset();
|
213
|
+
//timer.start();
|
214
214
|
}
|
215
215
|
|
216
216
|
protected function onAsyncMethodCalled(event:TimeoutCommandEvent):void {
|
@@ -73,7 +73,7 @@ package asunit.core {
|
|
73
73
|
assertEquals("Total Test Count", testMethodCount, core.bridge.runCount);
|
74
74
|
}
|
75
75
|
|
76
|
-
core.addEventListener(Event.COMPLETE, async.add(handler));
|
76
|
+
core.addEventListener(Event.COMPLETE, async.add(handler, 200));
|
77
77
|
core.start(Suite);
|
78
78
|
}
|
79
79
|
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 4
|
7
7
|
- 2
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- pre
|
10
|
-
version: 4.2.
|
10
|
+
version: 4.2.2.pre
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Luke Bayes
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-
|
20
|
+
date: 2010-07-05 00:00:00 -07:00
|
21
21
|
default_executable:
|
22
22
|
dependencies: []
|
23
23
|
|
@@ -34,8 +34,8 @@ files:
|
|
34
34
|
- air/AIR2Runner.mxml
|
35
35
|
- air/AIR2RunnerDescriptor.xml
|
36
36
|
- asunit4.gemspec
|
37
|
-
-
|
38
|
-
- bin/AsUnit-4.
|
37
|
+
- bin/AsUnit-4.2.1.pre.swc
|
38
|
+
- bin/AsUnit-4.2.2.pre.swc
|
39
39
|
- bin/AsUnitRunner.swf
|
40
40
|
- build.xml
|
41
41
|
- Gemfile
|
@@ -43,7 +43,13 @@ files:
|
|
43
43
|
- MIT-LICENSE.txt
|
44
44
|
- rakefile.rb
|
45
45
|
- README.textile
|
46
|
-
-
|
46
|
+
- sprout/lib/asunit4/suite_class_generator.rb
|
47
|
+
- sprout/lib/asunit4/templates/AsUnit4SuiteClass.as
|
48
|
+
- sprout/lib/asunit4/templates/AsUnit4TestClass.as
|
49
|
+
- sprout/lib/asunit4/test_class_generator.rb
|
50
|
+
- sprout/lib/asunit4.rb
|
51
|
+
- sprout/test/unit/test_class_generator_test.rb
|
52
|
+
- sprout/test/unit/test_helper.rb
|
47
53
|
- src/asunit/asserts/assertEquals.as
|
48
54
|
- src/asunit/asserts/assertEqualsArrays.as
|
49
55
|
- src/asunit/asserts/assertEqualsArraysIgnoringOrder.as
|
@@ -188,7 +194,7 @@ post_install_message:
|
|
188
194
|
rdoc_options: []
|
189
195
|
|
190
196
|
require_paths:
|
191
|
-
-
|
197
|
+
- sprout/lib
|
192
198
|
required_ruby_version: !ruby/object:Gem::Requirement
|
193
199
|
requirements:
|
194
200
|
- - ">="
|
data/asunit4.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'sprout'
|
2
|
-
|
3
|
-
module AsUnit
|
4
|
-
NAME = 'asunit4'
|
5
|
-
VERSION = '4.2.1.pre'
|
6
|
-
end
|
7
|
-
|
8
|
-
Sprout::Specification.new do |s|
|
9
|
-
s.name = AsUnit::NAME
|
10
|
-
s.version = AsUnit::VERSION
|
11
|
-
s.add_file_target do |f|
|
12
|
-
f.add_library :swc, 'bin/AsUnit-4.1.pre.swc'
|
13
|
-
f.add_library :src, ['src', 'vendor/as3reflection']
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
data/bin/AsUnit-4.1.pre.swc
DELETED
Binary file
|
data/script/generate
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'rubygems'
|
3
|
-
require 'sprout'
|
4
|
-
sprout 'sprout-as3-bundle'
|
5
|
-
|
6
|
-
# Add a class name if TestSuites were generated
|
7
|
-
if(ARGV.size == 1 && ARGV[0] == 'suite')
|
8
|
-
ARGV << 'AllTests'
|
9
|
-
end
|
10
|
-
|
11
|
-
# Insert class type by default
|
12
|
-
if(ARGV.size == 1)
|
13
|
-
ARGV.unshift('class')
|
14
|
-
end
|
15
|
-
|
16
|
-
# Execute generators like this:
|
17
|
-
# script/generate class utils.MathUtil
|
18
|
-
# script/generate suite
|
19
|
-
# script/generate test utils.MathUtilTest
|
20
|
-
|
21
|
-
Sprout::Sprout.generate('as3', ARGV.shift, ARGV, File.dirname(File.dirname(__FILE__)))
|