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

chore: move /tests out of /examples #6454

Closed
wants to merge 1 commit into from
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ jobs:
wing test main.w
cd ..
done
- name: Download examples/tests/valid/hello.test.w
- name: Download tests/valid/hello.test.w
run: |
curl -L https://raw.githubusercontent.com/winglang/wing/main/examples/tests/valid/hello.test.w > hello.test.w
curl -L https://raw.githubusercontent.com/winglang/wing/main/tests/valid/hello.test.w > hello.test.w
cat hello.test.w
- name: Run Compile
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tf-aws-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
id: setdirs
shell: bash
run: | # TODO: skipping std and external folders, when https://github.com/winglang/wing/issues/3168 is resolve- we'll skip only the external folder.
dirs=$(ls -d examples/tests/sdk_tests/*/ | sed 's/\/$//' | grep -v "external\|std" | jq -R -s -c 'split("\n")[:-1]')
dirs=$(ls -d tests/sdk_tests/*/ | sed 's/\/$//' | grep -v "external\|std" | jq -R -s -c 'split("\n")[:-1]')
processed_dirs=$(echo "{ \"directory\": $dirs }" | jq -c '[ .directory[] | {directory: ., name: (split("/") | last)}]')
wrapped_dirs=$(echo $processed_dirs | jq -c .)
echo "dirs=$wrapped_dirs" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
########################################################################
- name: Installing external js modules
run: |
cd examples/tests/sdk_tests
cd tests/sdk_tests
npm install

- name: Configure AWS credentials
Expand Down
6 changes: 3 additions & 3 deletions apps/wing/src/commands/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { BuiltinPlatform } from "@winglang/compiler";
import { describe, test, expect } from "vitest";
import { compile } from "./compile";

const exampleDir = resolve("../../examples/tests/valid");
const exampleErrorDir = resolve("../../examples/tests/error");
const exampleSmallDir = resolve("../../examples/tests/valid/subdir2");
const exampleDir = resolve("../../tests/valid");
const exampleErrorDir = resolve("../../tests/error");
const exampleSmallDir = resolve("../../tests/valid/subdir2");
const exampleFilePath = join(exampleDir, "captures.test.w");

function rndTargetDir() {
Expand Down
4 changes: 2 additions & 2 deletions apps/wingcli-v2/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ mod test {
#[test]
fn test_compile_sim() {
initialize();
let res = command_build("../../examples/tests/valid/hello.test.w".into(), Some(Target::Sim));
let res = command_build("../../tests/valid/hello.test.w".into(), Some(Target::Sim));
assert!(res.is_ok());
}

#[test]
fn test_compile_tfaws() {
initialize();
let res = command_build("../../examples/tests/valid/hello.test.w".into(), Some(Target::TfAws));
let res = command_build("../../tests/valid/hello.test.w".into(), Some(Target::TfAws));
assert!(res.is_ok());
}
}
8 changes: 4 additions & 4 deletions docs/contributing/01-start-here/05-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Now, you can edit a source file anywhere across the stack and run the compiler w
For example:

```sh
pnpm wing -- test examples/tests/valid/captures.test.w
pnpm wing -- test tests/valid/captures.test.w
```

This command runs the full Wing CLI with the given arguments. Turbo will ensure the CLI build is updated.
Expand Down Expand Up @@ -156,7 +156,7 @@ pnpm turbo wing:e2e

### Test Meta-Comments

In your wing files in `examples/tests/valid`, you can add a specially formatted comment to add additional information for hangar.
In your wing files in `tests/valid`, you can add a specially formatted comment to add additional information for hangar.
Inside this comment, a yaml block will be read and used for several purposes.

Example:
Expand All @@ -175,7 +175,7 @@ This is useful if, for example, the test requires docker. In our CI only linux s

### Benchmarks

Benchmark files are located in `examples/tests/valid/benchmarks`. To run the benchmarks, run the following command from anywhere in the monorepo:
Benchmark files are located in `tests/valid/benchmarks`. To run the benchmarks, run the following command from anywhere in the monorepo:

```sh
pnpm turbo wing:bench
Expand Down Expand Up @@ -220,7 +220,7 @@ The [insta](https://marketplace.visualstudio.com/items?itemName=mitsuhiko.insta)
To debug the Rust compiler on VSCode, first you need to install the [CodeLLDB extension](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb).<br/>
Next, you can use the `Debug Wing Compiler` launch configuration available on our [launch.json](https://github.com/winglang/wing/blob/main/.vscode/launch.json).

Open the `.w` file you wish to debug compilation for (e.g. `${workspaceFolder}/examples/tests/valid/hello.w`) and hit F5 to start debugging.
Open the `.w` file you wish to debug compilation for (e.g. `${workspaceFolder}/tests/valid/hello.w`) and hit F5 to start debugging.

## How do I make changes to the Wing grammar?

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/01-start-here/07-wingsdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ A resource in the SDK has several parts:
* A class that implements the polycon API and creates all of the required terraform resources. For example, [`src/shared-aws/bucket.ts`](https://github.com/winglang/wing/tree/main/libs/wingsdk/src/shared-aws/bucket.ts).
* A class that implements the inflight API that interacts with the cloud resource. For example, [`src/shared-aws/bucket.inflight.ts`](https://github.com/winglang/wing/tree/main/libs/wingsdk/src/shared-aws/bucket.inflight.ts).
* Unit tests for the cloud infrastructure. For example, [`test/target-tf-aws/bucket.test.ts`](https://github.com/winglang/wing/tree/main/libs/wingsdk/test/target-tf-aws/bucket.test.ts).
* End-to-end tests. These are added to the "examples" directory at the root of the repository. For example, [`examples/tests/sdk_tests/bucket/bucket_list.test.w`](https://github.com/winglang/wing/blob/main/examples/tests/sdk_tests/bucket/bucket_list.test.w).
* End-to-end tests. These are added to the "examples" directory at the root of the repository. For example, [`tests/sdk_tests/bucket/bucket_list.test.w`](https://github.com/winglang/wing/blob/main/tests/sdk_tests/bucket/bucket_list.test.w).

If you are implementing a new resource, or implementing an existing resource for a new cloud provider, try to take a look at code for existing resources (`Bucket`, `Function`, `Queue`) to see how to structure your code.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/06-tools/01-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Tests are written in `test` blocks that contain *inflight code*. In Wing, each t
against a separate copy of the application being tested.

In the following example
([test_bucket.test.w](https://github.com/winglang/wing/tree/main/examples/tests/valid/test_bucket.test.w)),
([test_bucket.test.w](https://github.com/winglang/wing/tree/main/tests/valid/test_bucket.test.w)),
the application consists of a single `cloud.Bucket` and two tests `"put"` and `"get"`.

```js
Expand Down
6 changes: 3 additions & 3 deletions libs/wingc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,16 +483,16 @@ mod sanity {

#[test]
fn can_compile_valid_files() {
compile_test("../../examples/tests/valid", false);
compile_test("../../tests/valid", false);
}

#[test]
fn can_compile_error_files() {
compile_test("../../examples/tests/error", false);
compile_test("../../tests/error", false);
}

#[test]
fn cannot_compile_invalid_files() {
compile_test("../../examples/tests/invalid", true);
compile_test("../../tests/invalid", true);
}
}
2 changes: 1 addition & 1 deletion libs/wingcompiler/src/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { tmpdir } from "os";
import { BuiltinPlatform } from "./constants";
import { compile } from "./compile";

const exampleDir = resolve("../../examples/tests/valid");
const exampleDir = resolve("../../tests/valid");
const exampleFilePath = join(exampleDir, "enums.test.w");

export async function generateTmpDir() {
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ packages:
- "apps/wing-console/packages/*"
- "apps/wing-console/console/*"
- "apps/wing-console/tools/*"
- "examples/tests/*"
- "tests/*"
- "examples/*"
- "apps/jsii-docgen/test/__fixtures__/**"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface IExist extends IDontExist {
// interface extends class
inflight class ISomeClass {}
interface ISomeInterface extends ISomeClass {
// Interface "ISomeInterface (at ../../examples/tests/invalid/interface.w:21:11)" extends "ISomeClass", which is not an interface
// Interface "ISomeInterface (at ../../tests/invalid/interface.w:21:11)" extends "ISomeClass", which is not an interface
}

// interface with multiple methods having the same name, different signature
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ test "equal sets" {
// FIXME: Doesn't work
// ERROR: unable to serialize immutable data object of type Datetime

// examples/tests/sdk_tests/expect/target/test/assert.main.wsim.256800.tmp/.wing/preflight.cjs:319
// tests/sdk_tests/expect/target/test/assert.main.wsim.256800.tmp/.wing/preflight.cjs:319

// let dt = datetime.fromIso("2023-07-18T20:18:25.177+03:00");

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading