<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#copied {background-color:#ccccff;}
tr.alt #copied {background-color:#bbbbf7;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="5">Commit in <b><tt>metaas/trunk/src/test/java/uk/co/badgersinfoil/metaas</tt></b></td></tr>
<tr><td><tt><a href="#file1">StatementTests.java</a></tt> </td><td></td><td align="right" id="added">+25</td><td align="right" id="removed">-3</td><td nowrap="nowrap" align="center">445 -> 446</td></tr>
</table>
<pre class="comment">
extra assertions to try and catch bugs in statement formatting/interpretation
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">metaas/trunk/src/test/java/uk/co/badgersinfoil/metaas</span><br />
<div class="fileheader"><big><b>StatementTests.java</b></big> <small id="info">445 -> 446</small></div>
<pre class="diff"><small id="info">--- trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2007-03-13 23:27:34 UTC (rev 445)
+++ trunk/src/test/java/uk/co/badgersinfoil/metaas/StatementTests.java        2007-03-13 23:29:28 UTC (rev 446)
@@ -1,6 +1,8 @@
</small></pre><pre class="diff" id="context"> package uk.co.badgersinfoil.metaas;
import java.io.IOException;
</pre><pre class="diff" id="added">+import java.util.List;
+
</pre><pre class="diff" id="context"> import uk.co.badgersinfoil.metaas.dom.ASBlock;
import uk.co.badgersinfoil.metaas.dom.ASClassType;
import uk.co.badgersinfoil.metaas.dom.ASCompilationUnit;
</pre><pre class="diff"><small id="info">@@ -27,17 +29,35 @@
</small></pre><pre class="diff" id="context">         private ActionScriptFactory fact = new ActionScriptFactory();
        private ASCompilationUnit unit;
        private ASMethod meth;
</pre><pre class="diff" id="added">+        private ASCompilationUnit reflect;
</pre><pre class="diff" id="context">
        protected void setUp() {
                unit = fact.newClass("Test");
                ASClassType clazz = (ASClassType)unit.getType();
                meth = clazz.newMethod("test", Visibility.PUBLIC, null);
</pre><pre class="diff" id="added">+                reflect = null;
</pre><pre class="diff" id="context">         }
        protected void tearDown() throws IOException {
</pre><pre class="diff" id="removed">-                CodeMirror.assertReflection(fact, unit);
</pre><pre class="diff" id="added">+                if (reflect == null) {
+                        reflect = assertReflection();
+                }
</pre><pre class="diff" id="context">         }
</pre><pre class="diff" id="added">+        private ASCompilationUnit assertReflection() throws IOException {
+                return CodeMirror.assertReflection(fact, unit);
+        }
+
+        private void assertFirstReflectedStatementIsA(Class expectedClass) throws IOException {
+                reflect = assertReflection();
+                ASClassType clazz = (ASClassType)reflect.getType();
+                ASMethod meth = clazz.getMethod("test");
+                List statements = meth.getStatementList();
+                Object stmt = statements.get(0);
+                assertTrue("Expected instance of "+expectedClass.getName()+", got "+stmt.getClass().getName(),
+                 expectedClass.isInstance(stmt));
+        }
+
</pre><pre class="diff" id="context">         public void testStatements() throws IOException {
                meth.setDocComment("\n doc\n comment!\n");
        }
</pre><pre class="diff"><small id="info">@@ -46,11 +66,12 @@
</small></pre><pre class="diff" id="context">                 meth.addStmt("a=1");
        }
</pre><pre class="diff" id="removed">-        public void testExpressionStatement() {
</pre><pre class="diff" id="added">+        public void testExpressionStatement() <span id="addedchars">throws IOException </span>{
</pre><pre class="diff" id="context">                 ASExpressionStatement exprStmt = meth.newExprStmt("go()");
                assertEquals("go()", exprStmt.getExpressionString());
                exprStmt.setExpression("stop()");
                assertEquals("stop()", exprStmt.getExpressionString());
</pre><pre class="diff" id="added">+                assertFirstReflectedStatementIsA(ASExpressionStatement.class);
</pre><pre class="diff" id="context">         }
        public void testIfStatement() {
</pre><pre class="diff"><small id="info">@@ -165,11 +186,12 @@
</small></pre><pre class="diff" id="context">                 assertTrue(decl.isConstant());
        }
        
</pre><pre class="diff" id="removed">-        public void testReturn() {
</pre><pre class="diff" id="added">+        public void testReturn() throws IOException {
</pre><pre class="diff" id="context">                 ASReturnStatement returnStmt = meth.newReturn(null);
                assertNull(returnStmt.getExpressionString());
                returnStmt.setExpression("false");
                assertEquals("false", returnStmt.getExpressionString());
</pre><pre class="diff" id="added">+                assertFirstReflectedStatementIsA(ASReturnStatement.class);
</pre><pre class="diff" id="context">         }
        public void testReturnRemoveExpr() {
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.12</small></center>
</body></html>