<commit_before>package asunit4.printers {
    
    import asunit.framework.Test;
    import asunit.framework.TestCase;
    import asunit4.framework.ITestSuccess;
    import asunit4.framework.TestSuccess;
    import asunit.framework.ITestFailure;
    import asunit4.framework.TestFailure;
    import asunit4.framework.IResult;
    import asunit4.framework.Result;

    public class TextPrinterTest extends TestCase {

        private var printer:FakeTextPrinter;
        private var test:Test;
        private var success:ITestSuccess;
        private var failure:ITestFailure;
        private var testResult:IResult;

        public function TextPrinterTest(method:String=null) {
            super(method);
        }

        override protected function setUp():void {
            super.setUp();
            printer    = new FakeTextPrinter();
            testResult = new Result();
            test       = new TestCase();
            failure    = new TestFailure(test, 'testSomethingThatFails', new Error('Fake Failure'));
            success    = new TestSuccess(test, 'testSomethingThatSucceeds');
            testResult.addListener(printer);
        }

        override protected function tearDown():void {
            super.tearDown();
            removeChild(printer);
            failure    = null;
            printer    = null;
            testResult = null;
            success    = null;
            test       = null;
        }

        private function executeASucceedingTest():void {
            testResult.onRunStarted();
            testResult.onTestStarted(test);
            testResult.onTestSuccess(success);
            testResult.onTestCompleted(test);
            testResult.onRunCompleted(null);
        }

        private function executeAFailingTest():void {
            testResult.onRunStarted();
            testResult.onTestStarted(test);
            testResult.onTestFailure(failure);
            testResult.onTestCompleted(test);
            testResult.onRunCompleted(null);
        }

        public function testPrinterOnTestSuccess():void {
            executeASucceedingTest();
            assertTrue("Printer should print OK", printer.toString().indexOf('OK') > -1);
        }

        public function testPrinterFailure():void {
            executeAFailingTest();
            var expected:String = "testSomethingThatFails : Error: Fake Failure";
            assertTrue("Printer should fail", printer.toString().indexOf(expected) > -1);
            trace("-----------------------");
            trace(">> PRINTER: " + printer);
            trace("-----------------------");
        }

        public function testPrinterDisplayed():void {
            addChild(printer);
            executeASucceedingTest();
            assertTrue("The output was displayed.", printer.getTextDisplay().text.indexOf('Time Summary:') > -1);
        }
    }
}

import asunit4.printers.TextPrinter;
import flash.text.TextField;

class FakeTextPrinter extends TextPrinter {

    // Prevent the printer from tracing results:
    override protected function logResult():void {
    }
<commit_msg>Removed big trace statement from TextPrinterTest<commit_after>package asunit4.printers {
    
    import asunit.framework.Test;
    import asunit.framework.TestCase;
    import asunit4.framework.ITestSuccess;
    import asunit4.framework.TestSuccess;
    import asunit.framework.ITestFailure;
    import asunit4.framework.TestFailure;
    import asunit4.framework.IResult;
    import asunit4.framework.Result;

    public class TextPrinterTest extends TestCase {

        private var printer:FakeTextPrinter;
        private var test:Test;
        private var success:ITestSuccess;
        private var failure:ITestFailure;
        private var testResult:IResult;

        public function TextPrinterTest(method:String=null) {
            super(method);
        }

        override protected function setUp():void {
            super.setUp();
            printer    = new FakeTextPrinter();
            testResult = new Result();
            test       = new TestCase();
            failure    = new TestFailure(test, 'testSomethingThatFails', new Error('Fake Failure'));
            success    = new TestSuccess(test, 'testSomethingThatSucceeds');
            testResult.addListener(printer);
        }

        override protected function tearDown():void {
            super.tearDown();
            removeChild(printer);
            failure    = null;
            printer    = null;
            testResult = null;
            success    = null;
            test       = null;
        }

        private function executeASucceedingTest():void {
            testResult.onRunStarted();
            testResult.onTestStarted(test);
            testResult.onTestSuccess(success);
            testResult.onTestCompleted(test);
            testResult.onRunCompleted(null);
        }

        private function executeAFailingTest():void {
            testResult.onRunStarted();
            testResult.onTestStarted(test);
            testResult.onTestFailure(failure);
            testResult.onTestCompleted(test);
            testResult.onRunCompleted(null);
        }

        public function testPrinterOnTestSuccess():void {
            executeASucceedingTest();
            assertTrue("Printer should print OK", printer.toString().indexOf('OK') > -1);
        }

        public function testPrinterFailure():void {
            executeAFailingTest();
            var expected:String = "testSomethingThatFails : Error: Fake Failure";
            assertTrue("Printer should fail", printer.toString().indexOf(expected) > -1);
        }

        public function testPrinterDisplayed():void {
            addChild(printer);
            executeASucceedingTest();
            assertTrue("The output was displayed.", printer.getTextDisplay().text.indexOf('Time Summary:') > -1);
        }
    }
}

import asunit4.printers.TextPrinter;
import flash.text.TextField;

class FakeTextPrinter extends TextPrinter {

    // Prevent the printer from tracing results:
    override protected function logResult():void {
    }

{'fraction_non_alphanumeric': 0.09734947643979057, 'fraction_numerical': 0.0032722513089005235, 'mean_word_length': 2.208923884514436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '967458', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1508, 'n_words': 320}