Skip to content

Commit ade8750

Browse files
author
James Brundage
committed
Updating Console Tests (Fixes #188)
1 parent ae54718 commit ade8750

2 files changed

Lines changed: 27 additions & 27 deletions

File tree

RegEx/Console/ANSI.tests.ps1

Lines changed: 0 additions & 27 deletions
This file was deleted.

RegEx/Console/Console.tests.ps1

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
describe 'Irregular Console Patterns' {
2+
it 'Can match any Escape sequence' {
3+
"$([char]0x1b)[0m" | ?<Console_Code> | Select-Object -ExpandProperty Length | Should -be 4
4+
5+
"$([char]0x1b)[1;3;5,~" | ?<Console_Code> | Select-Object -ExpandProperty Length | Should -be 9
6+
}
7+
context 'Console Colors' {
8+
it 'Can Match a 4-bit color' {
9+
$x = "$([char]0x1b)[32m" | ?<Console_4BitColor> -Extract
10+
$x.ColorNumber | Should -Be 2
11+
$x.IsForegroundColor | Should -Be 3
12+
}
13+
14+
it 'Can Match a 24-bit color' {
15+
$x = "$([char]0x1b)[38;2;255;100;0m" | ?<Console_24BitColor> -Extract
16+
$x.Red | Should -be 255
17+
$x.Green | Should -be 100
18+
$x.Blue | Should -be 0
19+
}
20+
}
21+
22+
context 'Console Styles' {
23+
it 'Can Match Console Styles' {
24+
@("$([char]0x1b)[3m Italics $([char]0x1b)[23m" | ?<Console_Style>).Count | Should -be 2
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)