-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pass rows / columns to child process
- Loading branch information
1 parent
6e7652b
commit 2969796
Showing
5 changed files
with
34 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
import test from '../../' | ||
import test from '../../'; | ||
import delay from 'delay'; | ||
|
||
|
||
function writeline() { | ||
for (var i = 0; i < 80; i++) { | ||
process.stdout.write(String(i % 10)) | ||
} | ||
function writeFullWidth(even, adjust) { | ||
return async function (t) { | ||
await delay(200); | ||
var len = Math[even ? 'floor' : 'ceil']((process.stdout.columns + adjust) / 2); | ||
for (var i = 0; i < len; i++) { | ||
process.stdout.write(String(i % 10)); | ||
await delay(1); | ||
} | ||
await delay(200); | ||
t.pass(); | ||
}; | ||
} | ||
|
||
test.serial(t=>{writeline(),t.pass()}); | ||
test.serial(t=>{writeline(),t.pass()}); | ||
test.serial(writeFullWidth(true, 0)); | ||
test.serial(writeFullWidth(false, 0)); | ||
test.serial(writeFullWidth(true, 1)); | ||
test.serial(writeFullWidth(false, 1)); | ||
test.serial(writeFullWidth(true, -2)); | ||
test.serial(writeFullWidth(false, -2)); | ||
test.serial(writeFullWidth(true, 1)); | ||
test.serial(writeFullWidth(false, 1)); | ||
test.serial(writeFullWidth(true, 0)); | ||
test.serial(writeFullWidth(false, 0)); | ||
test.serial(writeFullWidth(true, 0)); | ||
test.serial(writeFullWidth(false, 0)); |