summaryrefslogtreecommitdiff
path: root/doc/sample_html/cogapp_test_cogapp.html
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-10-04 21:34:54 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-10-04 21:34:54 -0400
commita201ff9a72ed8cccedf27ef712bae00e4532b48c (patch)
tree96710bbc3b95b5e8981b8b52c07e4e57deb161fd /doc/sample_html/cogapp_test_cogapp.html
parent4d906d76669dcaf823c0964bda83667307bd8e2e (diff)
downloadpython-coveragepy-a201ff9a72ed8cccedf27ef712bae00e4532b48c.tar.gz
Updated sample html report.coverage-3.1
Diffstat (limited to 'doc/sample_html/cogapp_test_cogapp.html')
-rw-r--r--doc/sample_html/cogapp_test_cogapp.html3920
1 files changed, 1960 insertions, 1960 deletions
diff --git a/doc/sample_html/cogapp_test_cogapp.html b/doc/sample_html/cogapp_test_cogapp.html
index 2f19e05..23355ae 100644
--- a/doc/sample_html/cogapp_test_cogapp.html
+++ b/doc/sample_html/cogapp_test_cogapp.html
@@ -2000,1966 +2000,1966 @@ function toggle_lines(btn, cls) {
</td>
<td class='text' valign='top'>
-<p class='pln'>&quot;&quot;&quot; Test cogapp.</p>
-<p class='pln'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</p>
-<p class='pln'>&quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>import unittest</p>
-<p class='stm run hide'>import os, random, re, StringIO, stat, sys, tempfile</p>
-<p class='stm run hide'>import path&nbsp; &nbsp;&nbsp; # Non-standard, from http://www.jorendorff.com/articles/python/path</p>
-<p class='stm run hide'>from cogapp import Cog, CogOptions, CogGenerator</p>
-<p class='stm run hide'>from cogapp import CogError, CogUsageError, CogGeneratedError</p>
-<p class='stm run hide'>from cogapp import usage, __version__</p>
-<p class='stm run hide'>from whiteutils import reindentBlock</p>
-<p class='stm run hide'>from makefiles import *</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class TestCase(unittest.TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Base class for all Cog test cases.&nbsp; Adds utility methods I like.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def assertRaisesMsg(self, excClass, msg, callableObj, *args, **kwargs):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Just like unittest.TestCase.assertRaises,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; but checks that the message is right too.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callableObj(*args, **kwargs)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; except excClass, exc:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; excMsg = str(exc)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not msg:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # No message provided: it passes.</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return&nbsp; #pragma: no cover</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif excMsg == msg:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Message provided, and we got the right message: it passes.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:&nbsp;&nbsp; #pragma: no cover</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Message provided, and it didn&#39;t match: fail!</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise self.failureException(&quot;Right exception, wrong message: got &#39;%s&#39; expected &#39;%s&#39;&quot; % (excMsg, msg))</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; else:&nbsp;&nbsp; #pragma: no cover</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if hasattr(excClass,&#39;__name__&#39;):</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; excName = excClass.__name__</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; excName = str(excClass)</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise self.failureException(&quot;Expected to raise %s, didn&#39;t get an exception at all&quot; % excName)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogTestsInMemory(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Test cases for cogapp.Cog()</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoCog(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; strings = [</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; &#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; \t \t \tx&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;hello&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;the cat\nin the\nhat.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;Horton\n\tHears A\n\t\tWho&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; for s in strings:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(s), s)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSimple(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some text.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line one\\n&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line two&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gobbledegook.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; outfile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some text.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line one\\n&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line two&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), outfile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEmptyCog(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # The cog clause can be totally empty.&nbsp; Not sure why you&#39;d want it,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # but it works.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testMultipleCogs(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # One file can have many cog chunks, even abutting each other.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk1&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk2&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; between chunks</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk3&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk3</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTrimBlankLines(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;This is line one\\n&quot;, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;&#39;, dedent=True, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line three&quot;, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line three</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTrimEmptyBlankLines(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;This is line one\\n&quot;, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;&#39;, dedent=True, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;, dedent=True, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line three&quot;, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line three</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def test22EndOfLine(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # In Python 2.2, this cog file was not parsing because the</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # last line is indented but didn&#39;t end with a newline.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testIndentedCode(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testPrefixedCode(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testPrefixedIndentedCode(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp;&nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp;&nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp;&nbsp; cog.out(&quot;xy%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testBogusPrefixMatch(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # This comment should not be clobbered by removing the pound sign.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;xy%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoFinalNewline(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # If the cog&#39;ed output has no final newline,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # it shouldn&#39;t eat up the cog terminator.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;%d&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 012</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoOutputAtAll(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # If there is absolutely no cog output, that&#39;s ok.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i = 1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testPurelyBlankLine(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # If there is a blank line in the cog code with no whitespace</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # prefix, that should be OK.</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import sys</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;Hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;There&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HelloThere</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile.replace(&#39;$&#39;, &#39;&#39;))</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEmptyOutl(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Alexander Belchenko suggested the string argument to outl should</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # be optional.&nbsp; Does it work?</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;x&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;y&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;z&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testFirstLineNum(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;started at line number %d&quot; % cog.firstLineNum)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; started at line number 2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;and again at line %d&quot; % cog.firstLineNum)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and again at line 8</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompactOneLineCode(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog cog.outl(&quot;hello %d&quot; % (3*3*3*3)) ]]] looky!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get rid of this!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; outfile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog cog.outl(&quot;hello %d&quot; % (3*3*3*3)) ]]] looky!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello 81</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), reindentBlock(outfile))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testInsideOutCompact(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey?: ]]] what is this? [[[cog strange!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get rid of this!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &quot;infile.txt(2): Cog code markers inverted&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Cog().processString,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; reindentBlock(infile), &quot;infile.txt&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSharingGlobals(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog s=&quot;hey there&quot; ]]] looky!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; more literal junk.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.outl(s) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; outfile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog s=&quot;hey there&quot; ]]] looky!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; more literal junk.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.outl(s) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey there</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), reindentBlock(outfile))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogOptionsTests(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Test the CogOptions class.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEquality(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(o, p)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o.parseArgs([&#39;-r&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertNotEqual(o, p)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p.parseArgs([&#39;-r&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(o, p)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCloning(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o.parseArgs([&#39;-I&#39;, &#39;fooey&#39;, &#39;-I&#39;, &#39;booey&#39;, &#39;-s&#39;, &#39; /*x*/&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p = o.clone()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(o, p)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p.parseArgs([&#39;-I&#39;, &#39;huey&#39;, &#39;-D&#39;, &#39;foo=quux&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertNotEqual(o, p)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; q = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; q.parseArgs([&#39;-I&#39;, &#39;fooey&#39;, &#39;-I&#39;, &#39;booey&#39;, &#39;-s&#39;, &#39; /*x*/&#39;, &#39;-I&#39;, &#39;huey&#39;, &#39;-D&#39;, &#39;foo=quux&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(p, q)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCombiningFlags(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Single-character flags can be combined.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o.parseArgs([&#39;-e&#39;, &#39;-r&#39;, &#39;-z&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p.parseArgs([&#39;-erz&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(o, p)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class FileStructureTests(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Test cases to check that we&#39;re properly strict about the structure</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; of files.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def isBad(self, infile, msg=None):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cog().processString, (infile), &#39;infile.txt&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testBeginNoEnd(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(2): Cog block begun but never ended.&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoEoo(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(4): Missing &#39;[[[end]]]&#39; before end of file.&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;goodbye&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(5): Unexpected &#39;[[[cog&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testStartWithEnd(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(1): Unexpected &#39;]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(5): Unexpected &#39;]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testStartWithEoo(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(1): Unexpected &#39;[[[end]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(5): Unexpected &#39;[[[end]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoEnd(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(3): Unexpected &#39;[[[end]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(7): Unexpected &#39;[[[end]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTwoBegins(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(2): Unexpected &#39;[[[cog&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(6): Unexpected &#39;[[[cog&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTwoEnds(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(4): Unexpected &#39;]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(8): Unexpected &#39;]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogErrorTests(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Test cases for cog.error().</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testErrorMsg(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.error(&quot;This ain&#39;t right!&quot;)]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogGeneratedError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;This ain&#39;t right!&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cog().processString, (infile))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testErrorNoMsg(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.error()]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogGeneratedError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Error raised by cog generator.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cog().processString, (infile))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoErrorIfErrorNotCalled(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; if i &gt; 10:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp; &nbsp; cog.error(&quot;Something is amiss!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogGeneratorGetCodeTests(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Unit tests against CogGenerator to see if its getCode() method works</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; properly.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def setUp(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; All tests get a generator to use, and short same-length names for</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the functions we&#39;re going to use.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.gen = CogGenerator()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m = self.gen.parseMarker</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l = self.gen.parseLine</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEmpty(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// ]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSimple(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;&nbsp; print &quot;hello&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;&nbsp; print &quot;bye&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// ]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;print &quot;hello&quot;\nprint &quot;bye&quot;&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompressed1(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # For a while, I supported compressed code blocks, but no longer.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog: print &quot;&quot;&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;// hello&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;// bye&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// &quot;&quot;&quot;)]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;hello\nbye&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompressed2(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # For a while, I supported compressed code blocks, but no longer.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog: print &quot;&quot;&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;hello&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;bye&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// &quot;&quot;&quot;)]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;hello\nbye&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompressed3(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # For a while, I supported compressed code blocks, but no longer.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;print &quot;&quot;&quot;hello&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;bye&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// &quot;&quot;&quot;)]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;print &quot;&quot;&quot;hello\nbye&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompressed4(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # For a while, I supported compressed code blocks, but no longer.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog: print &quot;&quot;&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;hello&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;bye&quot;&quot;&quot;)&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// ]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;hello\nbye&quot;&quot;&quot;)&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoCommonPrefixForMarkers(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # It&#39;s important to be able to use #if 0 to hide lines from a</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # C++ compiler.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;#if 0 //[[[cog&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;\timport cog, sys&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;\tprint sys.argv&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;#endif //]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;import cog, sys\n\nprint sys.argv&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class TestCaseWithTempDir(TestCase):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def newCog(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Initialize the cog members for another run.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Create a cog engine, and catch its output.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog = Cog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.output = StringIO.StringIO()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.setOutput(stdout=self.output, stderr=self.output)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def setUp(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Create a temporary directory.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.tempdir = path.path(tempfile.gettempdir()) / (&#39;testcog_tempdir_&#39; + str(random.random())[2:])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.tempdir.mkdir()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.olddir = os.getcwd()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; os.chdir(self.tempdir)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def tearDown(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; os.chdir(self.olddir)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Get rid of the temporary directory.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.tempdir.rmtree()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def assertFilesSame(self, sFName1, sFName2):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual((self.tempdir / sFName1).text(), (self.tempdir / sFName2).text())</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def assertFileContent(self, sFName, sContent):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; sAbsName = self.tempdir / sFName</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; f = open(sAbsName, &#39;rb&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sFileContent = f.read()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; finally:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.close()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(sFileContent, sContent)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class ArgumentHandlingTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testArgumentFailure(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Return value 2 means usage problem.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(self.cog.main([&#39;argv0&#39;, &#39;-j&#39;]) == 2)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;option -j not recognized&quot;) &gt;= 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-j&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoDashOAndAtFile(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-o&#39;, &#39;foo&#39;, &#39;@cogfiles.txt&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashV(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(self.cog.main([&#39;argv0&#39;, &#39;-v&#39;]) == 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(&#39;Cog version %s\n&#39; % __version__, output)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def producesHelp(self, args):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; argv = [&#39;argv0&#39;] + args.split()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(self.cog.main(argv) == 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEquals(usage, self.output.getvalue())</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashH(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # -h or -? anywhere on the command line should just print help.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.producesHelp(&quot;-h&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.producesHelp(&quot;-?&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.producesHelp(&quot;fooey.txt -h&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.producesHelp(&quot;-o -r @fooey.txt -? @booey.txt&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashOAndDashR(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfile.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-o&#39;, &#39;foo&#39;, &#39;-r&#39;, &#39;cogfile.txt&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashZ(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CogError, &quot;test.cog(6): Missing &#39;[[[end]]]&#39; before end of file.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-z&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testBadDashD(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-Dfooey&#39;, &#39;cog.txt&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-D&#39;, &#39;fooey&#39;, &#39;cog.txt&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class TestFileHandling(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSimple(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;(changed)&quot;) &gt;= 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testOutputFile(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # -o sets the output file.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-o&#39;, &#39;test.cogged&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cogged&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testAtFile(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye cruel world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;one.cog&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;two.cog&#39;, &#39;two.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;(changed)&quot;) &gt;= 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNestedAtFile(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye cruel world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @cogfiles2.txt</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles2.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # This one too, please.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;one.cog&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;two.cog&#39;, &#39;two.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;(changed)&quot;) &gt;= 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testAtFileWithArgs(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;both.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one: True // ONE</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two: False // ONE</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one: False // TWO</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two: True // TWO</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -o both.one -s &#39; // ONE&#39; -D one=x</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -o both.two -s &#39; // TWO&#39; -D two=x</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;both.one&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;both.two&#39;, &#39;two.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testAtFileWithBadArgCombo(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;both.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -d # This is bad: -r and -d</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testAtFileWithTrickyFilenames(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one 1.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;hello world&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;hello world&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world //xxx</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subdir&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subback.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with backslashes&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subfwd.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with slashes&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subback.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with backslashes&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; down deep with backslashes //yyy</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subfwd.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with slashes&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; down deep with slashes //zzz</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one 1.cog&#39; -s &#39; //xxx&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subdir\subback.cog -s &#39; //yyy&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subdir/subfwd.cog -s &#39; //zzz&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-z&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;one 1.cog&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;subdir/subback.cog&#39;, &#39;subback.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;subdir/subfwd.cog&#39;, &#39;subfwd.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogTestLineEndings(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Tests for -U option (force LF line-endings in output).&quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; lines_in = [&#39;Some text.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;//[[[cog&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog.outl(&quot;Cog text&quot;)&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;//]]]&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;gobbledegook.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;//[[[end]]]&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;epilogue.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;]</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; lines_out = [&#39;Some text.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;//[[[cog&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;cog.outl(&quot;Cog text&quot;)&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;//]]]&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;Cog text&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;//[[[end]]]&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;epilogue.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;&#39;]</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testOutputNativeEol(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles({&#39;infile&#39;: &#39;\n&#39;.join(self.lines_in)})</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-o&#39;, &#39;outfile&#39;, &#39;infile&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFileContent(&#39;outfile&#39;, os.linesep.join(self.lines_out))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testOutputLfEol(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles({&#39;infile&#39;: &#39;\n&#39;.join(self.lines_in)})</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-U&#39;, &#39;-o&#39;, &#39;outfile&#39;, &#39;infile&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFileContent(&#39;outfile&#39;, &#39;\n&#39;.join(self.lines_out))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReplaceNativeEol(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles({&#39;test.cog&#39;: &#39;\n&#39;.join(self.lines_in)})</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFileContent(&#39;test.cog&#39;, os.linesep.join(self.lines_out))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReplaceLfEol(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles({&#39;test.cog&#39;: &#39;\n&#39;.join(self.lines_in)})</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-U&#39;, &#39;-r&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFileContent(&#39;test.cog&#39;, &#39;\n&#39;.join(self.lines_out))</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class TestCaseWithImports(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; When running tests which import modules, the sys.modules list</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; leaks from one test to the next.&nbsp; This test case class scrubs</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; the list after each run to keep the tests isolated from each other.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def setUp(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; TestCaseWithTempDir.setUp(self)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.sysmodulekeys = list(sys.modules)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def tearDown(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; modstoscrub = [</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; modname</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for modname in sys.modules</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if modname not in self.sysmodulekeys</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; for modname in modstoscrub:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; del sys.modules[modname]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; TestCaseWithTempDir.tearDown(self)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogIncludeTests(TestCaseWithImports):</p>
-<p class='stm run hide'>&nbsp; &nbsp; dincludes = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mymodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test2.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mymodule in inc2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;include&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;mymodule.py&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mymodule&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;inc2&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;mymodule.py&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mymodule in inc2&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;inc3&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;someothermodule.py&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is some other module.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNeedIncludePath(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Try it without the -I, to see that an ImportError happens.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(ImportError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testIncludePath(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that -I adds include directories properly.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;include&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTwoIncludePaths(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that two -I&#39;s add include directories properly.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;include&#39;, &#39;-I&#39;, &#39;inc2&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTwoIncludePaths2(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that two -I&#39;s add include directories properly.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;inc2&#39;, &#39;-I&#39;, &#39;include&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test2.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testUselessIncludePath(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that the search will continue past the first directory.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;inc3&#39;, &#39;-I&#39;, &#39;include&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSysPathIsUnchanged(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;bad.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.error(&quot;Oh no!&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;good.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;Oh yes!&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged just by creating a cog engine?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; oldsyspath = sys.path[:]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a successful run?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;good.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a successful run with includes?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;xyzzy&#39;, &#39;good.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a successful run with two includes?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;xyzzy&#39;, &#39;-I&#39;, &#39;quux&#39;, &#39;good.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a failed run?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;bad.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a failed run with includes?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;xyzzy&#39;, &#39;bad.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a failed run with two includes?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;xyzzy&#39;, &#39;-I&#39;, &#39;quux&#39;, &#39;bad.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSubDirectories(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that relative paths on the command line work, with includes.</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;code&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mysubmodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mysubmodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mysubmodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;mysubmodule.py&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mysubmodule&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # We should be able to invoke cog without the -I switch, and it will</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # auto-include the current directory</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;code/test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;code/test.cog&#39;, &#39;code/test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogTestsInFiles(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testWarnIfNoCogCode(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that the -e switch warns if there is no Cog code.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;with.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;without.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; There&#39;s no cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; code in this file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-e&#39;, &#39;with.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;Warning&quot;) &lt; 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-e&#39;, &#39;without.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;Warning: no cog code found in without.cog&quot;) &gt;= 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;without.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;Warning&quot;) &lt; 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testFileNameProps(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this is cog1.txt in, cog1.txt out</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is cog1.txt in, cog1.txt out</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1out.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is cog1.txt in, cog1out.txt out</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-o&#39;, &#39;cog1out.txt&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1out.txt&#39;, &#39;cog1out.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testGlobalsDontCrossFiles(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Make sure that global values don&#39;t get shared between files.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog s = &quot;This was set in one.cog&quot; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(s) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog s = &quot;This was set in one.cog&quot; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(s) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This was set in one.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(s)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except NameError:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;s isn&#39;t set!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(s)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except NameError:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;s isn&#39;t set!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s isn&#39;t set!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;one.cog&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;two.cog&#39;, &#39;two.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;(changed)&quot;) &gt;= 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testRemoveGeneratedOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out2&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Remove generated output.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-x&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Regenerate the generated output.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out2&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Remove the generated output again.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-x&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testMsgCall(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.msg(&quot;Hello there!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.cog.processString(infile), infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(output, &quot;Message: Hello there!\n&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testErrorMessageHasNoTraceback(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that a Cog error is printed to stderr with no traceback.</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Xhis line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; stderr = StringIO.StringIO()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.setOutput(stderr=stderr)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.main([&#39;argv0&#39;, &#39;-c&#39;, &#39;-r&#39;, &quot;cog1.txt&quot;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.output.getvalue(), &quot;Cogging cog1.txt\n&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(stderr.getvalue(), &quot;cog1.txt(9): Output has been edited! Delete old checksum to unprotect.\n&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashD(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.kablooey&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defined fooey as kablooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.einstein&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defined fooey as e=mc2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-D&#39;, &#39;fooey=kablooey&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dfooey=kablooey&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dfooey=e=mc2&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.einstein&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dbar=quux&#39;, &#39;-Dfooey=kablooey&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dfooey=kablooey&#39;, &#39;-Dbar=quux&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dfooey=gooey&#39;, &#39;-Dfooey=kablooey&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testOutputToStdout(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&#39;Hey there!&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; stderr = StringIO.StringIO()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.setOutput(stderr=stderr)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; outerr = stderr.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(output, &quot;--[[[cog cog.outl(&#39;Hey there!&#39;) ]]]\nHey there!\n--[[[end]]]\n&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(outerr, &quot;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSuffixOutputLines(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hey there.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\n&nbsp;&nbsp; \\nc&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Good bye.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hey there.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\n&nbsp;&nbsp; \\nc&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a (foo)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b (foo)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c (foo)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Good bye.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-s&#39;, &#39; (foo)&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEmptySuffix(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\nc&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\nc&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-s&#39;, &#39;&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testHellishSuffix(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\n\\nb&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\n\\nb&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a /\\n*+([)]&gt;&lt;</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b /\\n*+([)]&gt;&lt;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-z&#39;, &#39;-r&#39;, &#39;-s&#39;, r&#39; /\n*+([)]&gt;&lt;&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class WritabilityTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='exc'>&nbsp; &nbsp; if os.name == &#39;nt&#39;:&nbsp; &nbsp;&nbsp; # pragma: no cover</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # for Windows</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; cmd_w_args = &#39;attrib -R %s&#39;</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; cmd_w_asterisk = &#39;attrib -R *&#39;</p>
-<p class='exc'>&nbsp; &nbsp; else:&nbsp;&nbsp; # pragma: no cover</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # for unix-like</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; cmd_w_args = &#39;chmod +w %s&#39;</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; cmd_w_asterisk = &#39;chmod +w *&#39;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def setUp(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; TestCaseWithTempDir.setUp(self)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.testcog = self.tempdir / &#39;test.cog&#39;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.testcog.chmod(stat.S_IREAD)&nbsp;&nbsp; # Make the file readonly.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert not os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def tearDown(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.testcog.chmod(stat.S_IWRITE)&nbsp;&nbsp; # Make the file writable again.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; TestCaseWithTempDir.tearDown(self)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReadonlyNoCommand(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CogError, &quot;Can&#39;t overwrite test.cog&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert not os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReadonlyWithCommand(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-w&#39;, self.cmd_w_args, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReadonlyWithCommandWithNoSlot(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-w&#39;, self.cmd_w_asterisk, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReadonlyWithIneffectualCommand(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CogError, &quot;Couldn&#39;t make test.cog writable&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;-w&#39;, &#39;echo %s&#39;, &#39;test.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert not os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class ChecksumTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCreateChecksumOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-c&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCheckChecksumOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-c&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testRemoveChecksumOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893) fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTamperedChecksumOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Xhis line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog2.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog3.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog4.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah..</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog5.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; extra</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog6.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog1.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog1.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog2.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog2.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog3.txt(10): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog3.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog4.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog4.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog5.txt(10): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog5.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog6.txt(6): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog6.txt&quot;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class BlakeTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; # Blake Winton&#39;s contributions.</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDeleteCode(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # -o sets the output file.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some Sample Code Here</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]Data Data</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; And Some More</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; And Some More</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-d&#39;, &#39;-o&#39;, &#39;test.cogged&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cogged&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDeleteCodeWithDashRFails(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;-d&#39;, &#39;test.cog&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSettingGlobals(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Blake Winton contributed a way to set the globals that will be used in</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # processFile().</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some Sample Code Here</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]&quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoBlake();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoWinton();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoContribution();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; globals = {}</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; globals[&#39;fnames&#39;] = [&#39;DoBlake&#39;, &#39;DoWinton&#39;, &#39;DoContribution&#39;]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.options.bDeleteCode = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.processFile(&#39;test.cog&#39;, &#39;test.cogged&#39;, globals=globals)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cogged&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class ErrorCallTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testErrorCallHasNoTraceback(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that cog.error() doesn&#39;t show a traceback.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;error.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.error(&quot;Something Bad!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.main([&#39;argv0&#39;, &#39;-r&#39;, &#39;error.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(output, &quot;Cogging error.cog\nError: Something Bad!\n&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testRealErrorHasTraceback(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that a genuine error does show a traceback.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;error.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise RuntimeError(&quot;Hey!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.main([&#39;argv0&#39;, &#39;-r&#39;, &#39;error.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; msg = &#39;Actual output:\n&#39; + output</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assert_(output.startswith(&quot;Cogging error.cog\nTraceback (most recent&quot;), msg)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assert_(output.find(&quot;RuntimeError: Hey!&quot;) &gt; 0, msg)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='exc'>if __name__ == &#39;__main__&#39;:&nbsp; &nbsp; &nbsp; #pragma: no cover</p>
-<p class='exc'>&nbsp; &nbsp; unittest.main()</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'># Things not yet tested:</p>
-<p class='pln'># - A bad -w command (currently fails silently).</p>
+<p class='pln'><span class='str'>&quot;&quot;&quot; Test cogapp.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>unittest</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>random</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>,</span> <span class='nam'>StringIO</span><span class='op'>,</span> <span class='nam'>stat</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>tempfile</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>path</span>&nbsp; &nbsp;&nbsp; <span class='com'># Non-standard, from http://www.jorendorff.com/articles/python/path</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>Cog</span><span class='op'>,</span> <span class='nam'>CogOptions</span><span class='op'>,</span> <span class='nam'>CogGenerator</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>CogGeneratedError</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>usage</span><span class='op'>,</span> <span class='nam'>__version__</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='nam'>reindentBlock</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>makefiles</span> <span class='key'>import</span> <span class='op'>*</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestCase</span><span class='op'>(</span><span class='nam'>unittest</span><span class='op'>.</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Base class for all Cog test cases.&nbsp; Adds utility methods I like.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>excClass</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>,</span> <span class='nam'>callableObj</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Just like unittest.TestCase.assertRaises,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; but checks that the message is right too.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>callableObj</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>excClass</span><span class='op'>,</span> <span class='nam'>exc</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>excMsg</span> <span class='op'>=</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>exc</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>msg</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># No message provided: it passes.</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span>&nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>excMsg</span> <span class='op'>==</span> <span class='nam'>msg</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Message provided, and we got the right message: it passes.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span>&nbsp;&nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Message provided, and it didn&#39;t match: fail!</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>(</span><span class='str'>&quot;Right exception, wrong message: got &#39;%s&#39; expected &#39;%s&#39;&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>excMsg</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span>&nbsp;&nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>,</span><span class='str'>&#39;__name__&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>excClass</span><span class='op'>.</span><span class='nam'>__name__</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>(</span><span class='str'>&quot;Expected to raise %s, didn&#39;t get an exception at all&quot;</span> <span class='op'>%</span> <span class='nam'>excName</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogTestsInMemory</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Test cases for cogapp.Cog()</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>strings</span> <span class='op'>=</span> <span class='op'>[</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39; &#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39; \t \t \tx&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;hello&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;the cat\nin the\nhat.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;Horton\n\tHears A\n\t\tWho&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some text.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line one\\n&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line two&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gobbledegook.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some text.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line one\\n&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line two&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>outfile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEmptyCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># The cog clause can be totally empty.&nbsp; Not sure why you&#39;d want it,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># but it works.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testMultipleCogs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># One file can have many cog chunks, even abutting each other.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk1&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk2&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; between chunks</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk3&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk3</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTrimBlankLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;This is line one\\n&quot;, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;&#39;, dedent=True, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line three&quot;, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line three</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTrimEmptyBlankLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;This is line one\\n&quot;, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;&#39;, dedent=True, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;, dedent=True, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line three&quot;, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line three</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>test22EndOfLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># In Python 2.2, this cog file was not parsing because the</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># last line is indented but didn&#39;t end with a newline.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testIndentedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testPrefixedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testPrefixedIndentedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp;&nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp;&nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp;&nbsp; cog.out(&quot;xy%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testBogusPrefixMatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # This comment should not be clobbered by removing the pound sign.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;xy%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoFinalNewline</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If the cog&#39;ed output has no final newline,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># it shouldn&#39;t eat up the cog terminator.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;%d&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 012</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoOutputAtAll</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If there is absolutely no cog output, that&#39;s ok.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i = 1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testPurelyBlankLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If there is a blank line in the cog code with no whitespace</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># prefix, that should be OK.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import sys</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;Hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;There&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HelloThere</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>&#39;$&#39;</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEmptyOutl</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Alexander Belchenko suggested the string argument to outl should</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># be optional.&nbsp; Does it work?</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;x&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl()</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;y&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;z&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testFirstLineNum</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;started at line number %d&quot; % cog.firstLineNum)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; started at line number 2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;and again at line %d&quot; % cog.firstLineNum)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and again at line 8</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompactOneLineCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog cog.outl(&quot;hello %d&quot; % (3*3*3*3)) ]]] looky!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get rid of this!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog cog.outl(&quot;hello %d&quot; % (3*3*3*3)) ]]] looky!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello 81</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>outfile</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testInsideOutCompact</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey?: ]]] what is this? [[[cog strange!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get rid of this!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&quot;infile.txt(2): Cog code markers inverted&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&quot;infile.txt&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSharingGlobals</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog s=&quot;hey there&quot; ]]] looky!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; more literal junk.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.outl(s) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog s=&quot;hey there&quot; ]]] looky!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; more literal junk.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.outl(s) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey there</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>outfile</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogOptionsTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Test the CogOptions class.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEquality</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-r&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertNotEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-r&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCloning</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;fooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;booey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>&#39; /*x*/&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>clone</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;huey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-D&#39;</span><span class='op'>,</span> <span class='str'>&#39;foo=quux&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertNotEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>q</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>q</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;fooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;booey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>&#39; /*x*/&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;huey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-D&#39;</span><span class='op'>,</span> <span class='str'>&#39;foo=quux&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>p</span><span class='op'>,</span> <span class='nam'>q</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCombiningFlags</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Single-character flags can be combined.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-e&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-z&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-erz&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>FileStructureTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Test cases to check that we&#39;re properly strict about the structure</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; of files.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>msg</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;infile.txt&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testBeginNoEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(2): Cog block begun but never ended.&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoEoo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(4): Missing &#39;[[[end]]]&#39; before end of file.&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;goodbye&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(5): Unexpected &#39;[[[cog&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testStartWithEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(1): Unexpected &#39;]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]&nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(5): Unexpected &#39;]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testStartWithEoo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(1): Unexpected &#39;[[[end]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(5): Unexpected &#39;[[[end]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(3): Unexpected &#39;[[[end]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(7): Unexpected &#39;[[[end]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTwoBegins</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(2): Unexpected &#39;[[[cog&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(6): Unexpected &#39;[[[cog&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTwoEnds</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(4): Unexpected &#39;]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(8): Unexpected &#39;]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogErrorTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Test cases for cog.error().</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testErrorMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.error(&quot;This ain&#39;t right!&quot;)]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogGeneratedError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;This ain&#39;t right!&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testErrorNoMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.error()]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogGeneratedError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Error raised by cog generator.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoErrorIfErrorNotCalled</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; if i &gt; 10:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp; &nbsp; cog.error(&quot;Something is amiss!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogGeneratorGetCodeTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Unit tests against CogGenerator to see if its getCode() method works</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; properly.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; All tests get a generator to use, and short same-length names for</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the functions we&#39;re going to use.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span> <span class='op'>=</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEmpty</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// ]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;&nbsp; print &quot;hello&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;&nbsp; print &quot;bye&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// ]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;print &quot;hello&quot;\nprint &quot;bye&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompressed1</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog: print &quot;&quot;&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;// hello&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;// bye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// &quot;&quot;&quot;)]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;hello\nbye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompressed2</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog: print &quot;&quot;&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;hello&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;bye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// &quot;&quot;&quot;)]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;hello\nbye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompressed3</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;print &quot;&quot;&quot;hello&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;bye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// &quot;&quot;&quot;)]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;print &quot;&quot;&quot;hello\nbye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompressed4</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog: print &quot;&quot;&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;hello&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;bye&quot;&quot;&quot;)&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// ]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;hello\nbye&quot;&quot;&quot;)&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoCommonPrefixForMarkers</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># It&#39;s important to be able to use #if 0 to hide lines from a</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># C++ compiler.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;#if 0 //[[[cog&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;\timport cog, sys&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;\tprint sys.argv&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;#endif //]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;import cog, sys\n\nprint sys.argv&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestCaseWithTempDir</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>newCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Initialize the cog members for another run.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Create a cog engine, and catch its output.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span> <span class='op'>=</span> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>,</span> <span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Create a temporary directory.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>tempfile</span><span class='op'>.</span><span class='nam'>gettempdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>/</span> <span class='op'>(</span><span class='str'>&#39;testcog_tempdir_&#39;</span> <span class='op'>+</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>random</span><span class='op'>.</span><span class='nam'>random</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='op'>[</span><span class='num'>2</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>olddir</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>olddir</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Get rid of the temporary directory.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>.</span><span class='nam'>rmtree</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFName1</span><span class='op'>,</span> <span class='nam'>sFName2</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName1</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName2</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>assertFileContent</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFName</span><span class='op'>,</span> <span class='nam'>sContent</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sAbsName</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sAbsName</span><span class='op'>,</span> <span class='str'>&#39;rb&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sFileContent</span> <span class='op'>=</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>sFileContent</span><span class='op'>,</span> <span class='nam'>sContent</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>ArgumentHandlingTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testArgumentFailure</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Return value 2 means usage problem.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-j&#39;</span><span class='op'>]</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>2</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;option -j not recognized&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-j&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoDashOAndAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;foo&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashV</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-v&#39;</span><span class='op'>]</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='str'>&#39;Cog version %s\n&#39;</span> <span class='op'>%</span> <span class='nam'>__version__</span><span class='op'>,</span> <span class='nam'>output</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>producesHelp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>argv</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>]</span> <span class='op'>+</span> <span class='nam'>args</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEquals</span><span class='op'>(</span><span class='nam'>usage</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashH</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># -h or -? anywhere on the command line should just print help.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>&quot;-h&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>&quot;-?&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>&quot;fooey.txt -h&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>&quot;-o -r @fooey.txt -? @booey.txt&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashOAndDashR</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfile.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;foo&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;cogfile.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashZ</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>&quot;test.cog(6): Missing &#39;[[[end]]]&#39; before end of file.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-z&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testBadDashD</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-D&#39;</span><span class='op'>,</span> <span class='str'>&#39;fooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestFileHandling</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;(changed)&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testOutputFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># -o sets the output file.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye cruel world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;one.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;two.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;two.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;(changed)&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNestedAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye cruel world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @cogfiles2.txt</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles2.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # This one too, please.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;one.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;two.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;two.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;(changed)&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testAtFileWithArgs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;both.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one: True // ONE</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two: False // ONE</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one: False // TWO</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two: True // TWO</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -o both.one -s &#39; // ONE&#39; -D one=x</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -o both.two -s &#39; // TWO&#39; -D two=x</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;both.one&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;both.two&#39;</span><span class='op'>,</span> <span class='str'>&#39;two.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testAtFileWithBadArgCombo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;both.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -d # This is bad: -r and -d</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testAtFileWithTrickyFilenames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one 1.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;hello world&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;hello world&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world //xxx</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subdir&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subback.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with backslashes&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subfwd.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with slashes&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subback.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with backslashes&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; down deep with backslashes //yyy</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subfwd.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with slashes&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; down deep with slashes //zzz</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one 1.cog&#39; -s &#39; //xxx&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subdir\subback.cog -s &#39; //yyy&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subdir/subfwd.cog -s &#39; //zzz&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-z&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;one 1.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;subdir/subback.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;subback.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;subdir/subfwd.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;subfwd.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogTestLineEndings</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Tests for -U option (force LF line-endings in output).&quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>lines_in</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;Some text.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;//[[[cog&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog.outl(&quot;Cog text&quot;)&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;//]]]&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;gobbledegook.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;//[[[end]]]&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;epilogue.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>lines_out</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;Some text.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;//[[[cog&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;cog.outl(&quot;Cog text&quot;)&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;//]]]&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;Cog text&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;//[[[end]]]&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;epilogue.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testOutputNativeEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>&#39;infile&#39;</span><span class='op'>:</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;outfile&#39;</span><span class='op'>,</span> <span class='str'>&#39;infile&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>&#39;outfile&#39;</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testOutputLfEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>&#39;infile&#39;</span><span class='op'>:</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-U&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;outfile&#39;</span><span class='op'>,</span> <span class='str'>&#39;infile&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>&#39;outfile&#39;</span><span class='op'>,</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReplaceNativeEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReplaceLfEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-U&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestCaseWithImports</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; When running tests which import modules, the sys.modules list</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; leaks from one test to the next.&nbsp; This test case class scrubs</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; the list after each run to keep the tests isolated from each other.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sysmodulekeys</span> <span class='op'>=</span> <span class='nam'>list</span><span class='op'>(</span><span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>modstoscrub</span> <span class='op'>=</span> <span class='op'>[</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>modname</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>modname</span> <span class='key'>in</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>modname</span> <span class='key'>not</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sysmodulekeys</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>modname</span> <span class='key'>in</span> <span class='nam'>modstoscrub</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>del</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>[</span><span class='nam'>modname</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogIncludeTests</span><span class='op'>(</span><span class='nam'>TestCaseWithImports</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>dincludes</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mymodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test2.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mymodule in inc2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;include&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;mymodule.py&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mymodule&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;inc2&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;mymodule.py&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mymodule in inc2&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;inc3&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;someothermodule.py&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is some other module.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNeedIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Try it without the -I, to see that an ImportError happens.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>ImportError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that -I adds include directories properly.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;include&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTwoIncludePaths</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that two -I&#39;s add include directories properly.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;include&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;inc2&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTwoIncludePaths2</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that two -I&#39;s add include directories properly.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;inc2&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;include&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test2.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testUselessIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that the search will continue past the first directory.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;inc3&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;include&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSysPathIsUnchanged</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;bad.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.error(&quot;Oh no!&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;good.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;Oh yes!&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged just by creating a cog engine?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>oldsyspath</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a successful run?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;good.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a successful run with includes?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;xyzzy&#39;</span><span class='op'>,</span> <span class='str'>&#39;good.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a successful run with two includes?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;xyzzy&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;quux&#39;</span><span class='op'>,</span> <span class='str'>&#39;good.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a failed run?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;bad.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a failed run with includes?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;xyzzy&#39;</span><span class='op'>,</span> <span class='str'>&#39;bad.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a failed run with two includes?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;xyzzy&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;quux&#39;</span><span class='op'>,</span> <span class='str'>&#39;bad.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSubDirectories</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that relative paths on the command line work, with includes.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;code&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mysubmodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mysubmodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mysubmodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;mysubmodule.py&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mysubmodule&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># We should be able to invoke cog without the -I switch, and it will</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># auto-include the current directory</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;code/test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;code/test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;code/test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogTestsInFiles</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testWarnIfNoCogCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that the -e switch warns if there is no Cog code.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;with.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;without.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; There&#39;s no cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; code in this file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-e&#39;</span><span class='op'>,</span> <span class='str'>&#39;with.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;Warning&quot;</span><span class='op'>)</span> <span class='op'>&lt;</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-e&#39;</span><span class='op'>,</span> <span class='str'>&#39;without.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;Warning: no cog code found in without.cog&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;without.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;Warning&quot;</span><span class='op'>)</span> <span class='op'>&lt;</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testFileNameProps</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this is cog1.txt in, cog1.txt out</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is cog1.txt in, cog1.txt out</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1out.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is cog1.txt in, cog1out.txt out</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1out.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1out.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1out.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testGlobalsDontCrossFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Make sure that global values don&#39;t get shared between files.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog s = &quot;This was set in one.cog&quot; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(s) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog s = &quot;This was set in one.cog&quot; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(s) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This was set in one.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(s)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except NameError:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;s isn&#39;t set!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(s)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except NameError:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;s isn&#39;t set!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s isn&#39;t set!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;one.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;two.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;two.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;(changed)&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testRemoveGeneratedOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out2&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Remove generated output.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-x&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Regenerate the generated output.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out2&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Remove the generated output again.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-x&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testMsgCall</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.msg(&quot;Hello there!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>&quot;Message: Hello there!\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testErrorMessageHasNoTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that a Cog error is printed to stderr with no traceback.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Xhis line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>stderr</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog1.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&quot;Cogging cog1.txt\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&quot;cog1.txt(9): Output has been edited! Delete old checksum to unprotect.\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashD</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defined fooey as kablooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.einstein&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defined fooey as e=mc2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-D&#39;</span><span class='op'>,</span> <span class='str'>&#39;fooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=e=mc2&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.einstein&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dbar=quux&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dbar=quux&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=gooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testOutputToStdout</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&#39;Hey there!&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>stderr</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outerr</span> <span class='op'>=</span> <span class='nam'>stderr</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>&quot;--[[[cog cog.outl(&#39;Hey there!&#39;) ]]]\nHey there!\n--[[[end]]]\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>outerr</span><span class='op'>,</span> <span class='str'>&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSuffixOutputLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hey there.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\n&nbsp;&nbsp; \\nc&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Good bye.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hey there.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\n&nbsp;&nbsp; \\nc&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a (foo)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b (foo)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c (foo)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Good bye.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>&#39; (foo)&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEmptySuffix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\nc&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\nc&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testHellishSuffix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\n\\nb&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\n\\nb&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a /\\n*+([)]&gt;&lt;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b /\\n*+([)]&gt;&lt;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-z&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>r&#39; /\n*+([)]&gt;&lt;&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>WritabilityTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>name</span> <span class='op'>==</span> <span class='str'>&#39;nt&#39;</span><span class='op'>:</span>&nbsp; &nbsp;&nbsp; <span class='com'># pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># for Windows</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cmd_w_args</span> <span class='op'>=</span> <span class='str'>&#39;attrib -R %s&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cmd_w_asterisk</span> <span class='op'>=</span> <span class='str'>&#39;attrib -R *&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span>&nbsp;&nbsp; <span class='com'># pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># for unix-like</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cmd_w_args</span> <span class='op'>=</span> <span class='str'>&#39;chmod +w %s&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cmd_w_asterisk</span> <span class='op'>=</span> <span class='str'>&#39;chmod +w *&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='str'>&#39;test.cog&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>stat</span><span class='op'>.</span><span class='nam'>S_IREAD</span><span class='op'>)</span>&nbsp;&nbsp; <span class='com'># Make the file readonly.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>stat</span><span class='op'>.</span><span class='nam'>S_IWRITE</span><span class='op'>)</span>&nbsp;&nbsp; <span class='com'># Make the file writable again.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReadonlyNoCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>&quot;Can&#39;t overwrite test.cog&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReadonlyWithCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-w&#39;</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cmd_w_args</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReadonlyWithCommandWithNoSlot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-w&#39;</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cmd_w_asterisk</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReadonlyWithIneffectualCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>&quot;Couldn&#39;t make test.cog writable&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-w&#39;</span><span class='op'>,</span> <span class='str'>&#39;echo %s&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>ChecksumTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCreateChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCheckChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testRemoveChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893) fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTamperedChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Xhis line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog2.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog3.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog4.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah..</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog5.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; extra</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog6.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog1.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog1.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog2.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog2.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog3.txt(10): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog3.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog4.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog4.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog5.txt(10): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog5.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog6.txt(6): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog6.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>BlakeTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># Blake Winton&#39;s contributions.&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDeleteCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># -o sets the output file.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some Sample Code Here</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]Data Data</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; And Some More</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; And Some More</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-d&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDeleteCodeWithDashRFails</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-d&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSettingGlobals</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Blake Winton contributed a way to set the globals that will be used in</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># processFile().</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some Sample Code Here</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]&quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoBlake();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoWinton();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoContribution();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>globals</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>globals</span><span class='op'>[</span><span class='str'>&#39;fnames&#39;</span><span class='op'>]</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;DoBlake&#39;</span><span class='op'>,</span> <span class='str'>&#39;DoWinton&#39;</span><span class='op'>,</span> <span class='str'>&#39;DoContribution&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>globals</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>ErrorCallTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testErrorCallHasNoTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that cog.error() doesn&#39;t show a traceback.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;error.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.error(&quot;Something Bad!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;error.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>&quot;Cogging error.cog\nError: Something Bad!\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testRealErrorHasTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that a genuine error does show a traceback.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;error.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise RuntimeError(&quot;Hey!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;error.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>msg</span> <span class='op'>=</span> <span class='str'>&#39;Actual output:\n&#39;</span> <span class='op'>+</span> <span class='nam'>output</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assert_</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>startswith</span><span class='op'>(</span><span class='str'>&quot;Cogging error.cog\nTraceback (most recent&quot;</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assert_</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;RuntimeError: Hey!&quot;</span><span class='op'>)</span> <span class='op'>&gt;</span> <span class='num'>0</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='exc'><span class='key'>if</span> <span class='nam'>__name__</span> <span class='op'>==</span> <span class='str'>&#39;__main__&#39;</span><span class='op'>:</span>&nbsp; &nbsp; &nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='nam'>unittest</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># Things not yet tested:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># - A bad -w command (currently fails silently).</span><span class="strut">&nbsp;</span></p>
</td>
</tr>