KJS: move println to kotlin.io; import kotlin.io by default in Default platform

This commit is contained in:
Zalim Bashorov
2016-12-24 22:45:08 +03:00
parent 7f10ce072f
commit 6ea6e4ab98
19 changed files with 112 additions and 104 deletions
+1
View File
@@ -2,6 +2,7 @@ var buffer = "";
function writeToBuffer(a) {
var type = typeof a;
if (type === "undefined") return;
if (type !== "string") throw Error("Expected string argument type, but got: " + type);
buffer += a;
+6 -6
View File
@@ -27,7 +27,7 @@ external var buffer: String = noImpl
fun test(expected: String, initCode: String, getResult: () -> String) {
buffer = ""
eval("kotlin.out = new $initCode")
eval("kotlin.kotlin.io.output = new $initCode")
print("Hello")
print(", World")
@@ -44,19 +44,19 @@ fun test(expected: String, initCode: String, getResult: () -> String) {
}
fun box(): String {
test(EXPECTED, "kotlin.NodeJsOutput(outputStream)") {
test(EXPECTED, "kotlin.kotlin.io.NodeJsOutput(outputStream)") {
buffer
}
test(EXPECTED_NEWLINE_FOR_EACH, "kotlin.OutputToConsoleLog()") {
test(EXPECTED_NEWLINE_FOR_EACH, "kotlin.kotlin.io.OutputToConsoleLog()") {
buffer
}
test(EXPECTED, "kotlin.BufferedOutput()") {
eval("kotlin.out.buffer") as String
test(EXPECTED, "kotlin.kotlin.io.BufferedOutput()") {
eval("kotlin.kotlin.io.output.buffer") as String
}
test(EXPECTED, "kotlin.BufferedOutputToConsoleLog()") {
test(EXPECTED, "kotlin.kotlin.io.BufferedOutputToConsoleLog()") {
buffer
}