From 21ad2d97e6b7849edf6078e6dc664857447c52ba Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 4 Aug 2017 12:46:50 +0300 Subject: [PATCH] Fix broken build. The fix for d8 readline() broke hello1 and hello2 tests. --- backend.native/tests/build.gradle | 4 ++-- runtime/src/launcher/js/launcher.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 1fa0b6206e9..74da580dbae 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -414,13 +414,13 @@ task hello0(type: RunKonanTest) { } task hello1(type: RunKonanTest) { - goldValue = "Hello World" + goldValue = "Hello World\n" testData = "Hello World\n" source = "runtime/basic/hello1.kt" } task hello2(type: RunKonanTest) { - goldValue = "you entered 'Hello World'" + goldValue = "you entered 'Hello World\n'" testData = "Hello World\n" source = "runtime/basic/hello2.kt" } diff --git a/runtime/src/launcher/js/launcher.js b/runtime/src/launcher/js/launcher.js index 20c4a61c005..2043700ca77 100644 --- a/runtime/src/launcher/js/launcher.js +++ b/runtime/src/launcher/js/launcher.js @@ -73,7 +73,9 @@ var konan_dependencies = { }, // TODO: Account for file and size. fgets: function(str, size, file) { - fromString(utf8encode(readline()), str); + // TODO: readline can't read lines without a newline. + // Browsers cant read from console at all. + fromString(utf8encode(readline() + '\n'), str); return str; }, Konan_heap_upper: function() {