From 1854c6f73be9d4439807911ce9cba1125af93dd4 Mon Sep 17 00:00:00 2001 From: Sander Hahn Date: Thu, 29 Oct 2020 18:35:58 +0100 Subject: fix(cli): prompt works with windows eol and eof (#8149) --- cli/tests/066_prompt.ts | 4 ++++ cli/tests/066_prompt.ts.out | 2 ++ cli/tests/integration_tests.rs | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'cli/tests') diff --git a/cli/tests/066_prompt.ts b/cli/tests/066_prompt.ts index 1c4a11f98..e3daa7ac0 100644 --- a/cli/tests/066_prompt.ts +++ b/cli/tests/066_prompt.ts @@ -12,6 +12,10 @@ const answer2 = confirm("Question 2"); // Answer with yes (returns false) console.log(`Your answer is ${answer2}`); const answer3 = confirm(); // Answer with default console.log(`Your answer is ${answer3}`); +const windows = prompt("What is Windows EOL?"); +console.log(`Your answer is ${JSON.stringify(windows)}`); alert("Hi"); alert(); console.log("The end of test"); +const eof = prompt("What is EOF?"); +console.log(`Your answer is ${JSON.stringify(eof)}`); diff --git a/cli/tests/066_prompt.ts.out b/cli/tests/066_prompt.ts.out index 88d73f34f..7defc51e5 100644 --- a/cli/tests/066_prompt.ts.out +++ b/cli/tests/066_prompt.ts.out @@ -5,4 +5,6 @@ Question 0 [y/N] Your answer is true Question 1 [y/N] Your answer is false Question 2 [y/N] Your answer is false Confirm [y/N] Your answer is false +What is Windows EOL? Your answer is "windows" Hi [Enter] Alert [Enter] The end of test +What is EOF? Your answer is null diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 0bba369fe..895c64098 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2185,7 +2185,7 @@ fn _066_prompt() { let args = "run --unstable 066_prompt.ts"; let output = "066_prompt.ts.out"; // These are answers to prompt, confirm, and alert calls. - let input = b"John Doe\n\nfoo\nY\nN\nyes\n\n\n\n"; + let input = b"John Doe\n\nfoo\nY\nN\nyes\n\nwindows\r\n\n\n"; util::test_pty(args, output, input); } -- cgit v1.2.3