Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): update docs #1033

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -29,6 +29,8 @@ fs.appendFile(filename, "testing");
let extendedValue = fs.readFile(filename);

log(extendedValue);

fs.remove(filename);
```

```bash title="Wing console output"
Expand Down
4 changes: 2 additions & 2 deletions example_versioned_docs/version-latest/32-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -31,7 +31,7 @@ test "bucket starts empty" {
}

test "this test fails" {
throw("test throws an exception fails");
throw "test throws an exception fails";
}
```

Expand Down
26 changes: 15 additions & 11 deletions example_versioned_docs/version-latest/35-exec-processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-latest/02-concepts/04-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
```

Expand Down