Skip to content

Commit

Permalink
Merge pull request #8 from Y-Nak/bumpup-version
Browse files Browse the repository at this point in the history
0.3.0 release
  • Loading branch information
Y-Nak authored May 16, 2024
2 parents d54fdf0 + dcc968f commit 396f5be
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use dir_test::{dir_test, Fixture};
dir: "$CARGO_MANIFEST_DIR/fixtures",
glob: "**/*.txt",
)]
fn test(fixture: Fixture<&str>) {
fn mytest(fixture: Fixture<&str>) {
// The file content and the absolute path of the file are available as follows.
let content = fixture.content();
let path = fixture.path();
Expand All @@ -31,7 +31,7 @@ fn test(fixture: Fixture<&str>) {
```

Assuming your crate is as follows, then the above code generates two test
cases `foo()` and `fixtures_a_bar()`.
cases `mytest__foo()` and `mytest__fixtures_a_bar()`.

```text
my-crate/
Expand All @@ -50,13 +50,13 @@ my-crate/

```rust, no_run
#[test]
fn foo() {
test(fixture);
fn mytest__foo() {
mytest(fixture);
}
#[test]
fn fixtures_a_bar() {
test(fixture);
fn mytest__fixtures_a_bar() {
mytest(fixture);
}
```

Expand Down
4 changes: 2 additions & 2 deletions dir-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dir-test"
authors = ["The Fe Project Developers"]
version = "0.2.1"
version = "0.3.0"
readme = "README.md"
edition = "2021"
license = "Apache-2.0"
Expand All @@ -12,7 +12,7 @@ categories = ["development-tools", "filesystem"]


[dependencies]
dir-test-macros = { version = "0.2.1", path = "../macros" }
dir-test-macros = { version = "0.3.0", path = "../macros" }

[dev-dependencies]
trybuild = { version = "1.0", features = ["diff"] }
16 changes: 16 additions & 0 deletions dir-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,19 @@ fn wasm_test(fixture: Fixture<std::io::Result<String>>) {

**NOTE**: The `dir_test_attr` attribute must be specified after the
`dir_test`.

### Return Types
Tests may have a return type, allowing for the [`Result<T, E>`] type to be used in the test.
See the relevant book link [here](https://doc.rust-lang.org/book/ch11-01-writing-tests.html#using-resultt-e-in-tests).

```rust, no_run
use dir_test::{dir_test, Fixture};
#[dir_test(
dir: "$CARGO_MANIFEST_DIR/fixtures",
glob: "**/*.txt",
)]
fn test(fixture: Fixture<&str>) -> std::io::Result<()> {
// ...
}
```
2 changes: 1 addition & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dir-test-macros"
authors = ["The Fe Project Developers"]
version = "0.2.1"
version = "0.3.0"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/fe-lang/dir-test"
Expand Down

0 comments on commit 396f5be

Please sign in to comment.