Re-append newline after "Hello, World!" output

See https://github.com/rtfeldman/roc/pull/2470#discussion_r821295601
(@rtfeldman has "seen some terminals get really unhappy if a program
prints things and doesn't print a newline to stdout before exiting")
This commit is contained in:
Jan Van Bruggen 2022-03-07 21:03:36 -07:00
parent 5d7c06321e
commit 589861a88a
10 changed files with 15 additions and 15 deletions

View File

@ -329,7 +329,7 @@ mod cli_run {
executable_filename: "hello_world",
stdin: &[],
input_file: None,
expected_ending:"Hello, World!",
expected_ending:"Hello, World!\n",
use_valgrind: true,
},
hello_c:"hello-world/c-platform" => Example {
@ -337,7 +337,7 @@ mod cli_run {
executable_filename: "hello_c",
stdin: &[],
input_file: None,
expected_ending:"Hello, World!",
expected_ending:"Hello, World!\n",
use_valgrind: true,
},
hello_zig:"hello-world/zig-platform" => Example {
@ -345,7 +345,7 @@ mod cli_run {
executable_filename: "hello_zig",
stdin: &[],
input_file: None,
expected_ending:"Hello, World!",
expected_ending:"Hello, World!\n",
use_valgrind: true,
},
hello_rust:"hello-world/rust-platform" => Example {
@ -353,7 +353,7 @@ mod cli_run {
executable_filename: "hello_rust",
stdin: &[],
input_file: None,
expected_ending:"Hello, World!",
expected_ending:"Hello, World!\n",
use_valgrind: true,
},
hello_swift:"hello-world/swift-platform" => Example {
@ -361,7 +361,7 @@ mod cli_run {
executable_filename: "hello_swift",
stdin: &[],
input_file: None,
expected_ending:"Hello, World!",
expected_ending:"Hello, World!\n",
use_valgrind: true,
},
hello_web:"hello-world/web-platform" => Example {
@ -369,7 +369,7 @@ mod cli_run {
executable_filename: "hello_web",
stdin: &[],
input_file: None,
expected_ending:"Hello, World!",
expected_ending:"Hello, World!\n",
use_valgrind: true,
},
fib:"algorithms" => Example {

View File

@ -15,7 +15,7 @@ cargo run --release hello_world.roc
## Design Notes
This demonstrates the basic design of hosts: Roc code gets compiled into a pure
function (in this case, a thunk that always returns `"Hello, World!"`) and
function (in this case, a thunk that always returns `"Hello, World!\n"`) and
then the host calls that function. Fundamentally, that's the whole idea! The host
might not even have a `main` - it could be a library, a plugin, anything.
Everything else is built on this basic "hosts calling linked pure functions" design.

View File

@ -3,4 +3,4 @@ app "hello_c"
imports []
provides [ main ] to pf
main = "Hello, World!"
main = "Hello, World!\n"

View File

@ -8,4 +8,4 @@ app "hello_world"
imports []
provides [ main ] to pf
main = "Hello, World!"
main = "Hello, World!\n"

View File

@ -3,4 +3,4 @@ app "hello_rust"
imports []
provides [ main ] to pf
main = "Hello, World!"
main = "Hello, World!\n"

View File

@ -3,4 +3,4 @@ app "hello_swift"
imports []
provides [ main ] to pf
main = "Hello, World!"
main = "Hello, World!\n"

View File

@ -28,7 +28,7 @@ Some of the above steps can be automated by running `./build.sh`.
## Design Notes
This demonstrates the basic design of hosts: Roc code gets compiled into a pure
function (in this case, a thunk that always returns `"Hello, World!"`) and
function (in this case, a thunk that always returns `"Hello, World!\n"`) and
then the host calls that function. Fundamentally, that's the whole idea! The host
might not even have a `main` - it could be a library, a plugin, anything.
Everything else is built on this basic "hosts calling linked pure functions" design.

View File

@ -3,4 +3,4 @@ app "hello_web"
imports []
provides [ main ] to pf
main = "Hello, World!"
main = "Hello, World!\n"

View File

@ -16,7 +16,7 @@ global.fetch = (filename) =>
const { roc_web_platform_run } = require("./host");
roc_web_platform_run("../hello_web.wasm", (string_from_roc) => {
const expected = "Hello, World!";
const expected = "Hello, World!\n";
if (string_from_roc !== expected) {
console.error(`Expected "${expected}", but got "${string_from_roc}"`);
process.exit(1);

View File

@ -3,4 +3,4 @@ app "hello_zig"
imports []
provides [ main ] to pf
main = "Hello, World!"
main = "Hello, World!\n"