more futzing with flexunit 4, about to switch from GNU make to Ant

cat-town
Dan Buch 15 years ago
parent de198dc590
commit 22ba96dbdd

@ -1,27 +0,0 @@
package me.tests
{
//import me.DebuggingApp;
import mx.core.Application;
//import org.flexunit.listeners.UIListener;
//import org.flexunit.runner.TestRunnerBase;
//import org.flexunit.runner.FlexUnitCore;
public class TestDebugging extends Application
{
//public var uiListener:TestRunnerBase;
//private var core:FlexUnitCore;
public function TestDebugging():void
{
this.addEventListener("creationComplete", runMe);
}
public function runMe():void
{
//core = new FlexUnitCore();
//core.addListener(new UIListener(uiListener));
//core.run(Debugging);
}
}
}

@ -1,19 +0,0 @@
package me.tests
{
import mx.core.Application;
import mx.controls.Alert;
import flash.events.Event;
public class TestFoo extends Application
{
public function TestFoo():void
{
this.addEventListener("creationComplete", alertPoo);
}
public function alertPoo(event:Event):void
{
Alert.show("poo!");
}
}
}

@ -0,0 +1,18 @@
package me.tests
{
import me.tests.cases.TestCase01;
import mx.core.Application;
import org.flexunit.Assert;
[Suite]
[RunWith("org.flexunit.runners.Suite")]
public class TestSuite extends Application
{
public var t1:TestCase01;
public function TestSuite():void
{
}
}
}

@ -0,0 +1,17 @@
package me.tests.cases
{
import org.flexunit.Assert;
public class TestCase01
{
public function TestCase01():void
{
}
[Test]
public function testMathIsRealistic():void
{
Assert.assertEquals(12, 2 * 6);
}
}
}

@ -12,6 +12,7 @@ from os.path import join as pathjoin, relpath, dirname, \
HERE = dirname(abspath(__file__))
FLEXUNIT = pathjoin('$(HOME)', '.local', 'share', 'flexunit')
AUTOGEN_WARNING = ('# ******** AUTOGENERATED by {0} ' +
('*' * 20)).format(basename(sys.argv[0]))
DEP_SEP = ' \\\n '
@ -22,7 +23,9 @@ RULE_FMT = '\\\n\t'.join([
'$(MXMLC_FLAGS) ',
'-l+={parent_dir} ',
'-l+={package_base} ',
'-l+={flexunit} ',
'-sp+={package_base} ',
'-sp+={flexunit} ',
'-o {target}',
])
@ -49,7 +52,7 @@ class TargetMaker(object):
def make(self):
self._glob_for_top_level_mxml_targets()
self._find_test_class_targets()
self._find_test_suite_targets()
self._write_out_targets()
def _glob_for_top_level_mxml_targets(self):
@ -57,16 +60,16 @@ class TargetMaker(object):
for mxml in glob.glob(pattern):
self._add_target_from_mxml(mxml)
def _find_test_class_targets(self):
def _find_test_suite_targets(self):
for dirpath, dirnames, filenames in os.walk(HERE):
filter_generated_dirs(dirnames)
for filename in filenames:
if is_test_class(filename):
test_class = pathjoin(dirpath, filename)
self._add_target_from_test_class(test_class)
if is_test_suite(filename):
test_suite = pathjoin(dirpath, filename)
self._add_target_from_test_suite(test_suite)
def _add_target_from_test_class(self, test_class):
rel_class = relpath(test_class, HERE)
def _add_target_from_test_suite(self, test_suite):
rel_class = relpath(test_suite, HERE)
as_swf = re.sub('(.*)\.as$', '\\1.swf', rel_class)
self.targets[as_swf] = set([rel_class])
@ -80,7 +83,7 @@ class TargetMaker(object):
basedir = dirname(rel_mxml)
for dirpath, dirnames, filenames in os.walk(basedir):
filter_generated_dirs(dirnames)
filter_test_classes(filenames)
filter_test_suitees(filenames)
for filename in filenames:
if ext(filename) in self._source_fileexts:
rel_source = relpath(pathjoin(dirpath, filename), HERE)
@ -96,9 +99,12 @@ class TargetMaker(object):
rel_target = './' + target.lstrip('./')
print(TARGET_FMT.format(target=rel_target,
deps=DEP_SEP.join(deps)), file=self.outstream)
deps=DEP_SEP.join(deps),
), file=self.outstream
)
print(RULE_FMT.format(**pattern_rule_kwargs) +
RULE_SEP, file=self.outstream)
RULE_SEP, file=self.outstream
)
def _get_deps_for_target(self, target):
deps = []
@ -120,7 +126,8 @@ class TargetMaker(object):
primary_dep=primary_dep,
parent_dir=dirname(primary_dep),
package_base=primary_dep.strip('./').split(pathsep)[0],
target=target
target=target,
flexunit=FLEXUNIT
)
return ret
@ -140,16 +147,16 @@ def filter_generated_dirs(dirnames):
dirnames[:] = list(ifilter(None, dirnames))
def filter_test_classes(filenames):
def filter_test_suitees(filenames):
for i, filename in enumerate(filenames[:]):
if is_test_class(filename):
if is_test_suite(filename):
filenames[i] = None
filenames[:] = list(ifilter(None, filenames))
def is_test_class(filename):
def is_test_suite(filename):
base_filename = basename(filename)
return base_filename.startswith('Test') and \
return base_filename.startswith('TestSuite') and \
ext(filename) == '.as'

@ -6,7 +6,9 @@
$(MXMLC_FLAGS) \
-l+=01-flickr \
-l+=01-flickr \
-l+=$(HOME)/.local/share/flexunit \
-sp+=01-flickr \
-sp+=$(HOME)/.local/share/flexunit \
-o 01-flickr/FlickrRIA.swf
@ -17,7 +19,9 @@
$(MXMLC_FLAGS) \
-l+=01-flickr \
-l+=01-flickr \
-l+=$(HOME)/.local/share/flexunit \
-sp+=01-flickr \
-sp+=$(HOME)/.local/share/flexunit \
-o 01-flickr/FlickrThumbnail.swf
@ -27,7 +31,9 @@
$(MXMLC_FLAGS) \
-l+=02-shipping \
-l+=02-shipping \
-l+=$(HOME)/.local/share/flexunit \
-sp+=02-shipping \
-sp+=$(HOME)/.local/share/flexunit \
-o 02-shipping/PlainText.swf
@ -37,7 +43,9 @@
$(MXMLC_FLAGS) \
-l+=03a1-binding-and-modeling \
-l+=03a1-binding-and-modeling \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03a1-binding-and-modeling \
-sp+=$(HOME)/.local/share/flexunit \
-o 03a1-binding-and-modeling/YahooWeather.swf
@ -48,7 +56,9 @@
$(MXMLC_FLAGS) \
-l+=03a2-crud-dynamic \
-l+=03a2-crud-dynamic \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03a2-crud-dynamic \
-sp+=$(HOME)/.local/share/flexunit \
-o 03a2-crud-dynamic/CRUDDynamic.swf
@ -59,7 +69,9 @@
$(MXMLC_FLAGS) \
-l+=03a3-crud-static \
-l+=03a3-crud-static \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03a3-crud-static \
-sp+=$(HOME)/.local/share/flexunit \
-o 03a3-crud-static/CRUDStatic.swf
@ -69,7 +81,9 @@
$(MXMLC_FLAGS) \
-l+=03a4-external-interface \
-l+=03a4-external-interface \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03a4-external-interface \
-sp+=$(HOME)/.local/share/flexunit \
-o 03a4-external-interface/Main.swf
@ -80,7 +94,9 @@
$(MXMLC_FLAGS) \
-l+=03a5-local-connections \
-l+=03a5-local-connections \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03a5-local-connections \
-sp+=$(HOME)/.local/share/flexunit \
-o 03a5-local-connections/BasicTaskReceiver.swf
@ -91,7 +107,9 @@
$(MXMLC_FLAGS) \
-l+=03a5-local-connections \
-l+=03a5-local-connections \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03a5-local-connections \
-sp+=$(HOME)/.local/share/flexunit \
-o 03a5-local-connections/TaskSender.swf
@ -101,7 +119,9 @@
$(MXMLC_FLAGS) \
-l+=03a6-shared-objects \
-l+=03a6-shared-objects \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03a6-shared-objects \
-sp+=$(HOME)/.local/share/flexunit \
-o 03a6-shared-objects/SharedObjectExample.swf
@ -111,7 +131,9 @@
$(MXMLC_FLAGS) \
-l+=03a7-validation-and-formatting \
-l+=03a7-validation-and-formatting \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03a7-validation-and-formatting \
-sp+=$(HOME)/.local/share/flexunit \
-o 03a7-validation-and-formatting/ValidatorsandFormattersExampleWithAreaCodeLookup.swf
@ -121,7 +143,9 @@
$(MXMLC_FLAGS) \
-l+=03b-handling-events \
-l+=03b-handling-events \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03b-handling-events \
-sp+=$(HOME)/.local/share/flexunit \
-o 03b-handling-events/TwitterTimeline.swf
@ -131,7 +155,9 @@
$(MXMLC_FLAGS) \
-l+=03b1-event-listeners \
-l+=03b1-event-listeners \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03b1-event-listeners \
-sp+=$(HOME)/.local/share/flexunit \
-o 03b1-event-listeners/VBoxDemo.swf
@ -141,7 +167,9 @@
$(MXMLC_FLAGS) \
-l+=03b2-event-propagation \
-l+=03b2-event-propagation \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03b2-event-propagation \
-sp+=$(HOME)/.local/share/flexunit \
-o 03b2-event-propagation/DemoApplication.swf
@ -152,7 +180,9 @@
$(MXMLC_FLAGS) \
-l+=03b3-simple-ui-event \
-l+=03b3-simple-ui-event \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03b3-simple-ui-event \
-sp+=$(HOME)/.local/share/flexunit \
-o 03b3-simple-ui-event/Example1.swf
@ -163,7 +193,9 @@
$(MXMLC_FLAGS) \
-l+=03b3-simple-ui-event \
-l+=03b3-simple-ui-event \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03b3-simple-ui-event \
-sp+=$(HOME)/.local/share/flexunit \
-o 03b3-simple-ui-event/Example2.swf
@ -173,7 +205,9 @@
$(MXMLC_FLAGS) \
-l+=03c1-application-container \
-l+=03c1-application-container \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c1-application-container \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c1-application-container/Demo.swf
@ -185,7 +219,9 @@
$(MXMLC_FLAGS) \
-l+=03c2-box-model \
-l+=03c2-box-model \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c2-box-model \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c2-box-model/HBoxExample.swf
@ -197,7 +233,9 @@
$(MXMLC_FLAGS) \
-l+=03c2-box-model \
-l+=03c2-box-model \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c2-box-model \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c2-box-model/VBoxExample.swf
@ -209,7 +247,9 @@
$(MXMLC_FLAGS) \
-l+=03c2-box-model \
-l+=03c2-box-model \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c2-box-model \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c2-box-model/VBoxHBoxCombo.swf
@ -219,7 +259,9 @@
$(MXMLC_FLAGS) \
-l+=03c3-canvas-absolute \
-l+=03c3-canvas-absolute \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c3-canvas-absolute \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c3-canvas-absolute/Example.swf
@ -229,7 +271,9 @@
$(MXMLC_FLAGS) \
-l+=03c4-canvas-relative \
-l+=03c4-canvas-relative \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c4-canvas-relative \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c4-canvas-relative/Photo.swf
@ -239,7 +283,9 @@
$(MXMLC_FLAGS) \
-l+=03c5-combined-layout \
-l+=03c5-combined-layout \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c5-combined-layout \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c5-combined-layout/Combined.swf
@ -249,7 +295,9 @@
$(MXMLC_FLAGS) \
-l+=03c6-form \
-l+=03c6-form \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c6-form \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c6-form/CommentForm.swf
@ -260,7 +308,9 @@
$(MXMLC_FLAGS) \
-l+=03c7-mxml-vs-as3 \
-l+=03c7-mxml-vs-as3 \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c7-mxml-vs-as3 \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c7-mxml-vs-as3/WithAs3.swf
@ -271,7 +321,9 @@
$(MXMLC_FLAGS) \
-l+=03c7-mxml-vs-as3 \
-l+=03c7-mxml-vs-as3 \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c7-mxml-vs-as3 \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c7-mxml-vs-as3/WithMxml.swf
@ -281,7 +333,9 @@
$(MXMLC_FLAGS) \
-l+=03c8-panel \
-l+=03c8-panel \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03c8-panel \
-sp+=$(HOME)/.local/share/flexunit \
-o 03c8-panel/Photo.swf
@ -293,7 +347,9 @@
$(MXMLC_FLAGS) \
-l+=03d1-datagrid \
-l+=03d1-datagrid \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03d1-datagrid \
-sp+=$(HOME)/.local/share/flexunit \
-o 03d1-datagrid/DataGridExample.swf
@ -304,7 +360,9 @@
$(MXMLC_FLAGS) \
-l+=03d2-item-renderers \
-l+=03d2-item-renderers \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03d2-item-renderers \
-sp+=$(HOME)/.local/share/flexunit \
-o 03d2-item-renderers/HBoxWeatherDisplay.swf
@ -315,7 +373,9 @@
$(MXMLC_FLAGS) \
-l+=03d2-item-renderers \
-l+=03d2-item-renderers \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03d2-item-renderers \
-sp+=$(HOME)/.local/share/flexunit \
-o 03d2-item-renderers/WeatherDisplay.swf
@ -326,7 +386,9 @@
$(MXMLC_FLAGS) \
-l+=03d3-lists \
-l+=03d3-lists \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03d3-lists \
-sp+=$(HOME)/.local/share/flexunit \
-o 03d3-lists/HorizontalListControl.swf
@ -337,7 +399,9 @@
$(MXMLC_FLAGS) \
-l+=03d3-lists \
-l+=03d3-lists \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03d3-lists \
-sp+=$(HOME)/.local/share/flexunit \
-o 03d3-lists/ListControl.swf
@ -347,7 +411,9 @@
$(MXMLC_FLAGS) \
-l+=03d4-tilelist \
-l+=03d4-tilelist \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03d4-tilelist \
-sp+=$(HOME)/.local/share/flexunit \
-o 03d4-tilelist/TileListExample.swf
@ -357,7 +423,9 @@
$(MXMLC_FLAGS) \
-l+=03e1-accordion \
-l+=03e1-accordion \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03e1-accordion \
-sp+=$(HOME)/.local/share/flexunit \
-o 03e1-accordion/Recipe.swf
@ -368,7 +436,9 @@
$(MXMLC_FLAGS) \
-l+=03e2-tabbar-linkbar \
-l+=03e2-tabbar-linkbar \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03e2-tabbar-linkbar \
-sp+=$(HOME)/.local/share/flexunit \
-o 03e2-tabbar-linkbar/LinkBar.swf
@ -379,7 +449,9 @@
$(MXMLC_FLAGS) \
-l+=03e2-tabbar-linkbar \
-l+=03e2-tabbar-linkbar \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03e2-tabbar-linkbar \
-sp+=$(HOME)/.local/share/flexunit \
-o 03e2-tabbar-linkbar/TabBarDemo.swf
@ -389,7 +461,9 @@
$(MXMLC_FLAGS) \
-l+=03e3-tabnavigator \
-l+=03e3-tabnavigator \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03e3-tabnavigator \
-sp+=$(HOME)/.local/share/flexunit \
-o 03e3-tabnavigator/Shopping.swf
@ -399,7 +473,9 @@
$(MXMLC_FLAGS) \
-l+=03e4-viewstack \
-l+=03e4-viewstack \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03e4-viewstack \
-sp+=$(HOME)/.local/share/flexunit \
-o 03e4-viewstack/ViewStackDemo.swf
@ -410,7 +486,9 @@
$(MXMLC_FLAGS) \
-l+=03f1-custom-components \
-l+=03f1-custom-components \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03f1-custom-components \
-sp+=$(HOME)/.local/share/flexunit \
-o 03f1-custom-components/MainForm.swf
@ -422,7 +500,9 @@
$(MXMLC_FLAGS) \
-l+=03f2-code-behind \
-l+=03f2-code-behind \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03f2-code-behind \
-sp+=$(HOME)/.local/share/flexunit \
-o 03f2-code-behind/CodeBehindDisplay.swf
@ -434,7 +514,9 @@
$(MXMLC_FLAGS) \
-l+=03f2-code-behind \
-l+=03f2-code-behind \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03f2-code-behind \
-sp+=$(HOME)/.local/share/flexunit \
-o 03f2-code-behind/CodeExample.swf
@ -446,7 +528,9 @@
$(MXMLC_FLAGS) \
-l+=03f3-composite-component \
-l+=03f3-composite-component \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03f3-composite-component \
-sp+=$(HOME)/.local/share/flexunit \
-o 03f3-composite-component/ComponentForm.swf
@ -458,7 +542,9 @@
$(MXMLC_FLAGS) \
-l+=03f4-multiple-composite-components \
-l+=03f4-multiple-composite-components \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03f4-multiple-composite-components \
-sp+=$(HOME)/.local/share/flexunit \
-o 03f4-multiple-composite-components/Main.swf
@ -469,7 +555,9 @@
$(MXMLC_FLAGS) \
-l+=03f5-mxml \
-l+=03f5-mxml \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03f5-mxml \
-sp+=$(HOME)/.local/share/flexunit \
-o 03f5-mxml/MainForm.swf
@ -479,7 +567,9 @@
$(MXMLC_FLAGS) \
-l+=03g1-debugging \
-l+=03g1-debugging \
-l+=$(HOME)/.local/share/flexunit \
-sp+=03g1-debugging \
-sp+=$(HOME)/.local/share/flexunit \
-o 03g1-debugging/Debugging.swf
@ -490,7 +580,9 @@
$(MXMLC_FLAGS) \
-l+=custom-03d1-datagrid \
-l+=custom-03d1-datagrid \
-l+=$(HOME)/.local/share/flexunit \
-sp+=custom-03d1-datagrid \
-sp+=$(HOME)/.local/share/flexunit \
-o custom-03d1-datagrid/Snarf.swf
@ -502,7 +594,9 @@
$(MXMLC_FLAGS) \
-l+=custom-03d2-item-renderers \
-l+=custom-03d2-item-renderers \
-l+=$(HOME)/.local/share/flexunit \
-sp+=custom-03d2-item-renderers \
-sp+=$(HOME)/.local/share/flexunit \
-o custom-03d2-item-renderers/HBoxWeatherDisplay.swf
@ -514,7 +608,9 @@
$(MXMLC_FLAGS) \
-l+=custom-03d2-item-renderers \
-l+=custom-03d2-item-renderers \
-l+=$(HOME)/.local/share/flexunit \
-sp+=custom-03d2-item-renderers \
-sp+=$(HOME)/.local/share/flexunit \
-o custom-03d2-item-renderers/WeatherDisplay.swf
@ -526,7 +622,9 @@
$(MXMLC_FLAGS) \
-l+=custom-03d3-lists \
-l+=custom-03d3-lists \
-l+=$(HOME)/.local/share/flexunit \
-sp+=custom-03d3-lists \
-sp+=$(HOME)/.local/share/flexunit \
-o custom-03d3-lists/ListControl.swf
@ -538,38 +636,35 @@
$(MXMLC_FLAGS) \
-l+=custom-03d4-tilelist \
-l+=custom-03d4-tilelist \
-l+=$(HOME)/.local/share/flexunit \
-sp+=custom-03d4-tilelist \
-sp+=$(HOME)/.local/share/flexunit \
-o custom-03d4-tilelist/TileListExample.swf
./custom-03g1-debugging/Debugging.swf: \
custom-03g1-debugging/Debugging.mxml \
custom-03g1-debugging/me/DebuggingApp.as
custom-03g1-debugging/me/DebuggingApp.as \
custom-03g1-debugging/me/tests/cases/TestCase01.as
$(MXMLC) custom-03g1-debugging/Debugging.mxml \
$(MXMLC_FLAGS) \
-l+=custom-03g1-debugging \
-l+=custom-03g1-debugging \
-l+=$(HOME)/.local/share/flexunit \
-sp+=custom-03g1-debugging \
-sp+=$(HOME)/.local/share/flexunit \
-o custom-03g1-debugging/Debugging.swf
./custom-03g1-debugging/me/tests/TestDebugging.swf: \
custom-03g1-debugging/me/tests/TestDebugging.as
$(MXMLC) custom-03g1-debugging/me/tests/TestDebugging.as \
./custom-03g1-debugging/me/tests/TestSuite.swf: \
custom-03g1-debugging/me/tests/TestSuite.as
$(MXMLC) custom-03g1-debugging/me/tests/TestSuite.as \
$(MXMLC_FLAGS) \
-l+=custom-03g1-debugging/me/tests \
-l+=custom-03g1-debugging \
-l+=$(HOME)/.local/share/flexunit \
-sp+=custom-03g1-debugging \
-o custom-03g1-debugging/me/tests/TestDebugging.swf
./custom-03g1-debugging/me/tests/TestFoo.swf: \
custom-03g1-debugging/me/tests/TestFoo.as
$(MXMLC) custom-03g1-debugging/me/tests/TestFoo.as \
$(MXMLC_FLAGS) \
-l+=custom-03g1-debugging/me/tests \
-l+=custom-03g1-debugging \
-sp+=custom-03g1-debugging \
-o custom-03g1-debugging/me/tests/TestFoo.swf
-sp+=$(HOME)/.local/share/flexunit \
-o custom-03g1-debugging/me/tests/TestSuite.swf

Loading…
Cancel
Save