Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c0af3ac

Browse filesBrowse files
HarshithaKPMylesBorins
authored andcommitted
test: use portable EOL
The test wanted to cut huge string into 1KB strings, for which a new line character was inserted at appropriate places. The value is different in Windows (10, 13). Make it portable, by making use of os.EOL semantics Refs: #25988 PR-URL: #32104 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent e83dcde commit c0af3ac
Copy full SHA for c0af3ac

File tree

Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-child-process-pipe-dataflow.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-pipe-dataflow.js
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const common = require('../common');
33
const assert = require('assert');
44
const path = require('path');
55
const fs = require('fs');
6+
const os = require('os');
67
const spawn = require('child_process').spawn;
78
const tmpdir = require('../common/tmpdir');
89

@@ -25,8 +26,8 @@ const MB = KB * KB;
2526
// meanings to new line - for example, line buffering.
2627
// So cut the buffer into lines at some points, forcing
2728
// data flow to be split in the stream.
28-
for (let i = 0; i < KB; i++)
29-
buf[i * KB] = 10;
29+
for (let i = 1; i < KB; i++)
30+
buf.write(os.EOL, i * KB);
3031
fs.writeFileSync(file, buf.toString());
3132

3233
cat = spawn('cat', [file]);
@@ -61,6 +62,7 @@ const MB = KB * KB;
6162
});
6263

6364
wc.stdout.on('data', common.mustCall((data) => {
64-
assert.strictEqual(data.toString().trim(), MB.toString());
65+
// Grep always adds one extra byte at the end.
66+
assert.strictEqual(data.toString().trim(), (MB + 1).toString());
6567
}));
6668
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.