Skip to content

Commit a0cd69a

Browse files
committed
fix \r
1 parent c9ccc1a commit a0cd69a

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

tests/Test_Table.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function test_column_odd_single_width_with_double_width() {
8686

8787
$strip_borders = function ( $a ) {
8888
return array_map( function ( $v ) {
89-
return substr( $v, 2, -2 );
89+
return substr( rtrim( $v, "\r" ), 2, -2 );
9090
}, $a );
9191
};
9292

@@ -97,13 +97,8 @@ public function test_column_odd_single_width_with_double_width() {
9797
$result = $strip_borders( explode( "\n", $out ) );
9898

9999
$this->assertSame( 3, count( $result ) );
100-
if ( Shell::is_windows() ) {
101-
$this->assertSame( '1あいうえ ', $result[0] );
102-
$this->assertSame( 'おか2きくカ ', $result[1] );
103-
} else {
104-
$this->assertSame( '1あいうえ ', $result[0] ); // 1 single-width, 4 double-width, space = 10.
105-
$this->assertSame( 'おか2きくカ', $result[1] ); // 2 double-width, 1 single-width, 2 double-width, 1 half-width = 10.
106-
}
100+
$this->assertSame( '1あいうえ ', $result[0] ); // 1 single-width, 4 double-width, space = 10.
101+
$this->assertSame( 'おか2きくカ', $result[1] ); // 2 double-width, 1 single-width, 2 double-width, 1 half-width = 10.
107102
$this->assertSame( 'けこ ', $result[2] ); // 2 double-width, 8 spaces = 10.
108103

109104
// Minimum width 1.
@@ -115,13 +110,8 @@ public function test_column_odd_single_width_with_double_width() {
115110

116111
$this->assertSame( 13, count( $result ) );
117112
// Uneven rows.
118-
if ( Shell::is_windows() ) {
119-
$this->assertSame( '1 ', $result[0] );
120-
$this->assertSame( '', $result[1] );
121-
} else {
122-
$this->assertSame( '1', $result[0] );
123-
$this->assertSame( '', $result[1] );
124-
}
113+
$this->assertSame( '1', $result[0] );
114+
$this->assertSame( '', $result[1] );
125115

126116
// Zero width does no wrapping.
127117

0 commit comments

Comments
 (0)