Scott, >> > - Could briefly summarize the motivation for the >> > suite()/JJSOptimizerTestDecator design? >> >> This way the module will be compiled only once. Unfortunately >> JavaToJavaScriptCompiler doesn't have any easily extract compiling >> pass and I didn't want to seriously refactor it. > > I'm not sure I totally understand. Are you suggesting that if you don't use > a suite and simply run the test class as a unit test, stuff happens multiple > times that shouldn't?
If you perform program compilation in setUp method - you'll compile all your code for every test. And this becomes really costly for 50 tests. So, the natural solution is to move compilation into some static context. But since our JavaToJavaScriptCompiler doesn't have any methods like compile() - the only way to plug into it seems to override optimize method and run your code there. This could be done either overriding runBare method in Test, which leads to compiling multiple times, or by using decorators. >> > - JJSOptimizerTestCase.staticJprogram strikes me as scary.. is this >> > necessary? >> >> How else would you pass values from static context? > > Why do we need to pass in values from a static context exactly? Because our tests need JProgram instance. If we're compiling only once - that's static context. >> > - Textual comparison seems like a great first step, but a bit brittle >> > going >> > forward. I'd worry that changes in the compiler totally unrelated to an >> > optimization pass would tend to unnecessarily break tests. >> >> That's a valid point and I saw this in the fast. I don't know a >> solution for this. Writing manual tree-based checks is even more >> fragile. However I do believe this is better than nothing. > > I know. But I would like to think of a way forward. Maybe we could take a > "before" and "after" string snapshot of the program, and validate only the > sections of the code that are different. You mean storing diffs instead of expected data? -- Regards, Mike --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
