From 795fcea095961a90d4e01aa6f53ba2ee0125c48f Mon Sep 17 00:00:00 2001 From: monabot Date: Thu, 10 Oct 2024 03:42:16 +0000 Subject: [PATCH] feat(docs): update docs Updates the Wing docs. See details in [workflow run]. [Workflow Run]: https://github.com/winglang/docsite/actions/runs/11267043323 ------ *Automatically created via the "update-docs" workflow* Signed-off-by: monabot --- .../30-reading-writing-files.md | 4 ++- .../version-latest/32-testing.md | 4 +-- .../version-latest/35-exec-processes.md | 26 +++++++++++-------- .../version-latest/02-concepts/04-tests.md | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/example_versioned_docs/version-latest/30-reading-writing-files.md b/example_versioned_docs/version-latest/30-reading-writing-files.md index b624ff9c..a54ade0c 100644 --- a/example_versioned_docs/version-latest/30-reading-writing-files.md +++ b/example_versioned_docs/version-latest/30-reading-writing-files.md @@ -11,7 +11,7 @@ image: /img/wing-by-example.png ```js playground example title="main.w" bring fs; -let filename: str = "/tmp/test.txt"; +let filename: str = fs.join(@dirname, "test.txt"); log(fs.exists(filename)); @@ -29,6 +29,8 @@ fs.appendFile(filename, "testing"); let extendedValue = fs.readFile(filename); log(extendedValue); + +fs.remove(filename); ``` ```bash title="Wing console output" diff --git a/example_versioned_docs/version-latest/32-testing.md b/example_versioned_docs/version-latest/32-testing.md index 7274e2f1..cc49afd0 100644 --- a/example_versioned_docs/version-latest/32-testing.md +++ b/example_versioned_docs/version-latest/32-testing.md @@ -10,7 +10,7 @@ image: /img/wing-by-example.png Wing incorporates a [lightweight testing framework](/docs/concepts/tests), which is built around the `wing test` command and the `test` keyword. -```js playground example title="main.w" +```js playground example{valid: false} title="main.w" bring math; bring cloud; let b = new cloud.Bucket(); @@ -31,7 +31,7 @@ test "bucket starts empty" { } test "this test fails" { - throw("test throws an exception fails"); + throw "test throws an exception fails"; } ``` diff --git a/example_versioned_docs/version-latest/35-exec-processes.md b/example_versioned_docs/version-latest/35-exec-processes.md index f3a10ee6..0c187d55 100644 --- a/example_versioned_docs/version-latest/35-exec-processes.md +++ b/example_versioned_docs/version-latest/35-exec-processes.md @@ -11,21 +11,25 @@ image: /img/wing-by-example.png ```js playground example title="main.w" bring util; -let output = util.exec("echo", ["-n", "Hello, Wing!"]); +let dir = @dirname; -// exec with custom environment variables -let output2 = util.exec("bash", ["--norc", "--noprofile", "-c", "echo $WING_TARGET $ENV_VAR"], { env: { ENV_VAR: "Wing" } }); +test "exec()" { + let output = util.exec("echo", ["-n", "Hello, Wing!"]); -// exec with inherited environment variables -let output3 = util.exec("bash", ["--norc", "--noprofile", "-c", "echo $WING_TARGET $ENV_VAR"], { inheritEnv: true }); + // exec with custom environment variables + let output2 = util.exec("bash", ["--norc", "--noprofile", "-c", "echo $WING_TARGET $ENV_VAR"], { env: { ENV_VAR: "Wing" } }); -// exec with current working directory -let output4 = util.exec("bash", ["--norc", "--noprofile", "-c", "echo Hello"], { cwd: "/tmp" }); + // exec with inherited environment variables + let output3 = util.exec("bash", ["--norc", "--noprofile", "-c", "echo $WING_TARGET $ENV_VAR"], { inheritEnv: true }); -log(output); -log(output2); -log(output3); -log(output4); + // exec with custom working directory + let output4 = util.exec("bash", ["--norc", "--noprofile", "-c", "echo Hello"], { cwd: dir }); + + log(output); + log(output2); + log(output3); + log(output4); +} ``` ```bash title="Wing console output" diff --git a/versioned_docs/version-latest/02-concepts/04-tests.md b/versioned_docs/version-latest/02-concepts/04-tests.md index 7fb091a6..cc901ffc 100644 --- a/versioned_docs/version-latest/02-concepts/04-tests.md +++ b/versioned_docs/version-latest/02-concepts/04-tests.md @@ -158,7 +158,7 @@ test "bucket starts empty" { } test "this test should fail" { - throw("test throws an exception fails"); + throw "test throws an exception fails"; } ```