<commit_before><?hh //strict
namespace HackPack\HackUnit\UI;

use HackPack\HackUnit\Core\TestCase;
use HackPack\HackUnit\Core\TestResult;
use HackPack\HackUnit\Core\ExpectationException;
use HackPack\HackUnit\UI\Text;

class TextTest extends TestCase
{
    public function test_getFooter_should_return_count_summary(): void
    {
        $result = $this->getResult();
        $ui = new Text();
        $this->expect($ui->getFooter($result))->toEqual("FAILURES!\n1 run, 1 failed\n");
    }

    public function test_getFooter_should_return_OK_message_when_no_failures(): void
    {
        $result = new TestResult();
        $result->testStarted();
        $ui = new Text();
        $this->expect($ui->getFooter($result))->toEqual("OK 1 run, 0 failed\n");
    }

    public function test_getFailures_should_print_failure_information(): void
    {
        $result = $this->getResult();
        $ui = new Text();
        $expected = $this->getExpectedFailures(28, "test_getFailures_should_print_failure_information");
        $this->expect($ui->getFailures($result))->toEqual($expected);
    }

    public function test_getReport_should_return_entire_message(): void
    {
        $result = $this->getResult();
        $result->startTimer();
        $ui = new Text();
        $expectedFailures = $this->getExpectedFailures(36, "test_getReport_should_return_entire_message");
        $expected = "\n\nTime: 0.00 seconds\n\nThere was 1 failure:\n\n" . $expectedFailures . "FAILURES!\n1 run, 1 failed\n";
        $this->expect($ui->getReport($result))->toEqual($expected);
    }

    public function test_getFooter_should_include_color_on_OK_statement_when_color_enabled(): void
    {
        $result = new TestResult();
        $result->testStarted();
        $ui = new Text();
        $ui->enableColor();

        $expected = sprintf(
            "\033[%d;%dmOK 1 run, 0 failed\033[0m\n",
            $ui->colors->get('bg-green'),
            $ui->colors->get('fg-black')
        );
        $this->expect($ui->getFooter($result))->toEqual($expected);
    }

    public function test_getFooter_should_include_color_and_padding_for_FAILURES_when_color_enabled(): void
    {
        $result = $this->getResult();
        $ui = new Text();
        $ui->enableColor();

        $expected = sprintf(
            "\033[%d;%dmFAILURES!      \n1 run, 1 failed\033[0m\n",
            $ui->colors->get('bg-red'),
            $ui->colors->get('fg-white')
        );<commit_msg>UI Text test queries the runner actual time.<commit_after><?hh //strict
namespace HackPack\HackUnit\UI;

use HackPack\HackUnit\Core\TestCase;
use HackPack\HackUnit\Core\TestResult;
use HackPack\HackUnit\Core\ExpectationException;
use HackPack\HackUnit\UI\Text;

class TextTest extends TestCase
{
    public function test_getFooter_should_return_count_summary(): void
    {
        $result = $this->getResult();
        $ui = new Text();
        $this->expect($ui->getFooter($result))->toEqual("FAILURES!\n1 run, 1 failed\n");
    }

    public function test_getFooter_should_return_OK_message_when_no_failures(): void
    {
        $result = new TestResult();
        $result->testStarted();
        $ui = new Text();
        $this->expect($ui->getFooter($result))->toEqual("OK 1 run, 0 failed\n");
    }

    public function test_getFailures_should_print_failure_information(): void
    {
        $result = $this->getResult();
        $ui = new Text();
        $expected = $this->getExpectedFailures(28, "test_getFailures_should_print_failure_information");
        $this->expect($ui->getFailures($result))->toEqual($expected);
    }

    public function test_getReport_should_return_entire_message(): void
    {
        $result = $this->getResult();
        $result->startTimer();
        $ui = new Text();
        $expectedFailures = $this->getExpectedFailures(36, "test_getReport_should_return_entire_message");
        $time = sprintf('%4.2f', $result->getTime());
        $expected = "\n\nTime: $time seconds\n\nThere was 1 failure:\n\n" . $expectedFailures . "FAILURES!\n1 run, 1 failed\n";
        $this->expect($ui->getReport($result))->toEqual($expected);
    }

    public function test_getFooter_should_include_color_on_OK_statement_when_color_enabled(): void
    {
        $result = new TestResult();
        $result->testStarted();
        $ui = new Text();
        $ui->enableColor();

        $expected = sprintf(
            "\033[%d;%dmOK 1 run, 0 failed\033[0m\n",
            $ui->colors->get('bg-green'),
            $ui->colors->get('fg-black')
        );
        $this->expect($ui->getFooter($result))->toEqual($expected);
    }

    public function test_getFooter_should_include_color_and_padding_for_FAILURES_when_color_enabled(): void
    {
        $result = $this->getResult();
        $ui = new Text();
        $ui->enableColor();

        $expected = sprintf(
            "\033[%d;%dmFAILURES!      \n1 run, 1 failed\033[0m\n",
            $ui->colors->get('bg-red'),
            $ui->colors->get('fg-white')
        );
{'fraction_non_alphanumeric': 0.15249500998003993, 'fraction_numerical': 0.012574850299401197, 'mean_word_length': 2.983306836248013, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 72, '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': '313639', 'n_tokens_mistral': 1622, 'n_tokens_neox': 1576, 'n_words': 260}