### ----------------------------------------------------
### -- Terminal::ANSIParser
### -- Licenses: Artistic-2.0
### -- Authors: Geoffrey Broadwell
### -- File: xt/05-incomplete-extra.rakutest
### ----------------------------------------------------
use v6.d;
use Test;
use lib $*PROGRAM.parent.sibling('t').child('lib');
use ParserTestHelpers;

use Terminal::ANSIParser;


plan 8;


my @seconds  = flat 0x20..0x2F, 0x50, 0x58, 0x5B, 0x5D..0x5F;
my @starters = flat 0x1B,       0x90, 0x98, 0x9B, 0x9D..0x9F;
my @flushers = flat @starters, Nil;

for @flushers -> $flush {
    subtest "{$flush // 'undefined'} flushes properly", {
        for 0x90, 0x9B, (0x1B, 0x50), (0x1B, 0x5B) -> $introducer {
            for flat 0x20..0x2F, 0xA1..0xAF -> $ib {
                my @partial = flat $introducer.list, $ib;
                incomplete(@partial, $flush);
            }

            for flat 0x30..0x39, 0x3B..0x3F, 0xB0..0xB9, 0xBB..0xBF -> $pb {
                my @partial = flat $introducer.list, $pb;
                incomplete(@partial, $flush);
            }

            for flat 0x30..0x39, 0x3B..0x3F, 0xB0..0xB9, 0xBB..0xBF -> $pb {
                for flat 0x20..0x2F, 0xA1..0xAF -> $ib {
                    my @partial = flat $introducer.list, $pb;
                    incomplete(@partial, $flush);
                }
            }
        }
    }
}


done-testing;


