Hi all, has anyone made any progress on this?
regards, Christophe 2008/1/6, aduston1976 <[EMAIL PROTECTED]>: > > Hi, Sorry for being out of the conversation for a few days. > > I ran into a problem while trying to do this using hxasm. If I write > out the bytecode for a class definition to a ByteArray, and the class > inherits from a custom class that is part of my swf rather than a > standard class like Object, then Loader#loadBytes will throw an > exception indicating that the class couldn't be found. I couldn't > overcome this behavior no matter what LoaderContext I passed to the > loadBytes method. I don't know enough about linking in AS3 to explain > what is going on behind the scenes here, though I'm sure that some > Adobe employees would expect this behavior and could explain the > reason for it very easily To make the behavior more concrete, I would > be happy to share my code with you folks. > > Drew, I will message you offline. I am very happy to see that other > people are interested in working on this problem also. The Metal > Hurlant blog post looks potentially promising. > > Adam > > --- In [email protected] <flexcoders%40yahoogroups.com>, Drew > Bourne <[EMAIL PROTECTED]> wrote: > > > > Hi Christophe, > > > > Ohh neatness! Thanks for the heads up, I had no idea Haxe had that > > feature. > > > > I'm going to spend some time on this tonight & tomorrow. > > > > cheers, > > Drew > > > > > > On 03/01/2008, at 9:53 PM, Christophe Herreman wrote: > > > > > Hi Drew, > > > > > > just FYI: Adam and I talked about this some days ago. I pointed him > > > to the fact that you could easily convert the Haxe code to AS3 > > > using a flag for the Haxe compiler. In case you are interested, I > > > have uploaded the hxasm code and the as3 version here:http:// > > > www.herrodius.com/upload/hxasm.zip > > > > > > @Adam: Did you make some more progress? > > > > > > regards, > > > Christophe > > > > > > > > > > > > 2008/1/2, Drew Bourne < [EMAIL PROTECTED]>: > > > > As the author of that mock framework Adam linked to I thought I > > > should chip in with my thoughts on the issues that have been raised. > > > > > > Regarding having to hand code the implementation of the class you > > > want to mock I have found that with a couple of snippet templates for > > > TextMate I can write them quite quickly. > > > > > > If you are going to hand-code stubs for use in testing without using > > > a framework you are adding behaviour to a class which means you > > > should then be testing that class too. > > > > > > To ease some of the pain until we can generate mock objects from > > > interfaces I intend to bundle a bunch of support classes that provide > > > mocks for many of the core flash class (think URLLoader, > > > EventDispatcher, Socket, etc). Speak up if you've got suggestions for > > > the classes you would like to see included initially. > > > > > > I have a couple of ideas about what we would need to be able to > > > generate the mock classes: > > > > > > 1) Generate the .as for the mock from reflection information at > > > runtime, then compile the generated .as at runtime with a self-hosted > > > compiler (AS3 compiler in AS3) then load it via Loader.loadBytes and > > > flash.utils.getDefinitionByName > > > > > > 2) Write an AS3 Parser in something like Java or Ruby that would > > > provide access to the Abstract Syntax Tree from which we can generate > > > the mock class, then compile the generated .as with mxmlc along with > > > the test suite. > > > > > > By implementing a tool that provides the AST for an AS3 class we open > > > up the doors for lots of fun like generating mocks, AOP, code > > > mutation (think adding hooks for code coverage reporting, mutation > > > testing, additional metadata directives) > > > > > > There is work in the Tamarin project for a self-hosted compiler > > > however last I checked it wasn't far enough along for our purposes. > > > > > > The hxASM library looks interesting and could definately be an avenue > > > worth exploring for this. Adam, I would be interested in > > > collaborating on getting a port of hxASM to AS3 so that we can > > > generate the necessary bytecodes to create mocks from an interface at > > > runtime. > > > > > > cheers, > > > Drew > > > > > > > > > > > > > > > -- > > > Christophe Herreman > > > http://www.herrodius.com > > > http://www.pranaframework.org > > > > > > > > > > > -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org

