Skip to content

Commit d230365

Browse files
authored
test: Fix new kinds of outputs to normalize (#340)
1 parent 83cd37e commit d230365

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

tests/Integration/OutputNormalizer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ public static function normalizeMemoryUsage(string $output): string
6969
public static function normalizeProgressBarTimeTaken(string $output): string
7070
{
7171
$output = str_replace(
72-
'< 1 sec',
73-
'10 secs',
72+
['< 1 sec', '< 1 ms'],
73+
['10 secs', '10 secs'],
7474
$output,
7575
);
7676

7777
return preg_replace(
78-
'/\d+ secs?/',
78+
'/\d+ (secs?|ms|s)/',
7979
'10 secs',
8080
$output,
8181
);

tests/Integration/OutputNormalizerTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ public static function progressBarTimeTakenProvider(): iterable
8888
' 10 secs ',
8989
];
9090

91+
yield '[non-fixed size bar] millisecond' => [
92+
' 243 ms ',
93+
' 10 secs ',
94+
];
95+
96+
yield '[non-fixed size bar] second' => [
97+
' 1 s ',
98+
' 10 secs ',
99+
];
100+
91101
yield '[non-fixed size bar] single digit' => [
92102
' 7 secs ',
93103
' 10 secs ',
@@ -103,6 +113,11 @@ public static function progressBarTimeTakenProvider(): iterable
103113
' 10 secs/10 secs',
104114
];
105115

116+
yield '[fixed size bar] less than a millisecond' => [
117+
' < 1 ms/< 1 ms',
118+
' 10 secs/10 secs',
119+
];
120+
106121
yield '[fixed size bar] single digit' => [
107122
' 4 secs/7 secs',
108123
' 10 secs/10 secs',
@@ -426,6 +441,11 @@ public static function outputProvider(): iterable
426441
' 4 [--->------------------------] 10 secs 10.0 MiB',
427442
];
428443

444+
yield 'standard non-fixed sized progress bar line with ms' => [
445+
' 4 [--->------------------------] < 1 ms 8.0 MiB',
446+
' 4 [--->------------------------] 10 secs 10.0 MiB',
447+
];
448+
429449
yield 'standard non-fixed sized progress bar line with extra padding' => [
430450
' 4 [--->------------------------] < 1 sec 8.0 MiB',
431451
' 4 [--->------------------------] 10 secs 10.0 MiB',

0 commit comments

Comments
 (0)