Skip to content

Commit

Permalink
Fix Book examples on Windows (#202, #200)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilslv committed Feb 2, 2022
1 parent 7b78a6f commit 644abfc
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 38 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ jobs:
if: ${{ github.ref == 'refs/heads/main'
|| startsWith(github.ref, 'refs/tags/v')
|| !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- macOS
- windows
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand Down
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ All user visible changes to `cucumber` crate will be documented in this file. Th



## [0.11.4] · 2022-02-??
[0.11.4]: /../../tree/v0.11.4

[Diff](/../../compare/v0.11.3...v0.11.4) | [Milestone](/../../milestone/9)

### Fixed

- Book examples failing on Windows. ([#202], [#200])

[#200]: /../../issues/200
[#202]: /../../pull/202




## [0.11.3] · 2022-01-31
[0.11.3]: /../../tree/v0.11.3

Expand All @@ -15,7 +30,7 @@ All user visible changes to `cucumber` crate will be documented in this file. Th

- `parser::Basic` skipping files named `.feature`. ([#201])

[#201]: /../../issues/201
[#201]: /../../pull/201



Expand Down
4 changes: 2 additions & 2 deletions book/src/architecture/parser.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ impl<I> cucumber::Parser<I> for CustomParser {
async fn main() {
AnimalWorld::cucumber::<&str>() // aiding type inference
.with_parser(CustomParser)
.run_and_exit("/tests/features/book") // path doesn't actually matter
.await; // here due to our implementation
.run_and_exit("tests/features/book") // path doesn't actually matter
.await; // here due to our implementation
}
```
![record](../rec/architecture_parser.gif)
Expand Down
2 changes: 1 addition & 1 deletion book/src/architecture/runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ async fn main() {
AnimalWorld::cucumber::<&str>() // aiding type inference for `CustomParser`
.with_parser(CustomParser)
.with_runner(CustomRunner)
.run_and_exit("/tests/features/book")
.run_and_exit("tests/features/book")
.await;
}
```
Expand Down
4 changes: 2 additions & 2 deletions book/src/architecture/writer.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ async fn main() {
.with_parser(CustomParser)
.with_runner(CustomRunner)
.with_writer(CustomWriter.assert_normalized()) // OK because of `CustomRunner`
.run("/tests/features/book")
.run("tests/features/book")
.await;
}
```
Expand Down Expand Up @@ -469,7 +469,7 @@ async fn main() {
AnimalWorld::cucumber::<&str>() // aiding type inference for `CustomParser`
.with_parser(CustomParser)
.with_writer(CustomWriter.normalized()) // wrapping into `writer::Normalize`,
.run("/tests/features/book") // so it works OK with the default
.run("tests/features/book") // so it works OK with the default
.await; // concurrent `Runner`
}
```
Expand Down
2 changes: 1 addition & 1 deletion book/src/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async fn main() {
AnimalWorld::cucumber()
.before(move |_, _, _, _| sleep(pre_pause).boxed_local())
.with_cli(opts)
.run_and_exit("/tests/features/book/cli.feature")
.run_and_exit("tests/features/book/cli.feature")
.await;
}
```
Expand Down
2 changes: 1 addition & 1 deletion book/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async fn is_full(w: &mut World) {
#
# #[tokio::main]
# async fn main() {
# World::run("/tests/features/readme").await;
# World::run("tests/features/readme").await;
# }
```
![record](rec/readme.gif)
Expand Down
14 changes: 7 additions & 7 deletions book/src/output/terminal.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async fn feed_cat(_: &mut AnimalWorld) {}
# #[tokio::main]
# async fn main() {
# AnimalWorld::cucumber()
# .run_and_exit("/tests/features/book/output/terminal_verbose.feature")
# .run_and_exit("tests/features/book/output/terminal_verbose.feature")
# .await;
# }
```
Expand Down Expand Up @@ -155,7 +155,7 @@ Feature: Animal feature
#[tokio::main]
async fn main() {
AnimalWorld::cucumber()
.run_and_exit("/tests/features/book/output/terminal_verbose.feature")
.run_and_exit("tests/features/book/output/terminal_verbose.feature")
.await;
}
```
Expand Down Expand Up @@ -229,7 +229,7 @@ Coloring may be disabled by specifying `--color` CLI option:
#[tokio::main]
async fn main() {
AnimalWorld::cucumber()
.run_and_exit("/tests/features/book/output/terminal.feature")
.run_and_exit("tests/features/book/output/terminal.feature")
.await;
}
```
Expand Down Expand Up @@ -308,7 +308,7 @@ async fn feed_cat(world: &mut AnimalWorld) {
# #[tokio::main]
# async fn main() {
# AnimalWorld::cucumber()
# .run_and_exit("/tests/features/book/output/terminal.feature")
# .run_and_exit("tests/features/book/output/terminal.feature")
# .await;
# }
```
Expand Down Expand Up @@ -387,7 +387,7 @@ async fn main() {
.summarized()
.assert_normalized(),
)
.run_and_exit("/tests/features/book/output/terminal.feature")
.run_and_exit("tests/features/book/output/terminal.feature")
.await;
}
```
Expand Down Expand Up @@ -465,7 +465,7 @@ As a number of [scenario]s grows, it may become quite difficult to find failed/s
async fn main() {
AnimalWorld::cucumber()
.repeat_failed()
.run_and_exit("/tests/features/book/output/terminal_repeat_failed.feature")
.run_and_exit("tests/features/book/output/terminal_repeat_failed.feature")
.await;
}
```
Expand Down Expand Up @@ -534,7 +534,7 @@ async fn main() {
async fn main() {
AnimalWorld::cucumber()
.repeat_skipped()
.run_and_exit("/tests/features/book/output/terminal_repeat_skipped.feature")
.run_and_exit("tests/features/book/output/terminal_repeat_skipped.feature")
.await;
}
```
Expand Down
14 changes: 7 additions & 7 deletions book/src/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn main() {
// You may choose any executor you like (`tokio`, `async-std`, etc.).
// You may even have an `async` main, it doesn't matter. The point is that
// Cucumber is composable. :)
futures::executor::block_on(AnimalWorld::run("/tests/features/book"));
futures::executor::block_on(AnimalWorld::run("tests/features/book"));
}
```

Expand Down Expand Up @@ -149,7 +149,7 @@ fn feed_cat(world: &mut AnimalWorld) {
}
#
# fn main() {
# futures::executor::block_on(AnimalWorld::run("/tests/features/book/quickstart/simple.feature"));
# futures::executor::block_on(AnimalWorld::run("tests/features/book/quickstart/simple.feature"));
# }
```

Expand Down Expand Up @@ -208,7 +208,7 @@ fn cat_is_fed(world: &mut AnimalWorld) {
}
#
# fn main() {
# futures::executor::block_on(AnimalWorld::run("/tests/features/book/quickstart/simple.feature"));
# futures::executor::block_on(AnimalWorld::run("tests/features/book/quickstart/simple.feature"));
# }
```

Expand Down Expand Up @@ -267,7 +267,7 @@ fn cat_is_fed(world: &mut AnimalWorld) {
assert!(world.cat.hungry);
}
# fn main() {
# futures::executor::block_on(AnimalWorld::run("/tests/features/book/quickstart/simple.feature"));
# futures::executor::block_on(AnimalWorld::run("tests/features/book/quickstart/simple.feature"));
# }
```

Expand Down Expand Up @@ -345,7 +345,7 @@ fn hungry_cat(world: &mut AnimalWorld, state: String) {
# }
#
# fn main() {
# futures::executor::block_on(AnimalWorld::run("/tests/features/book/quickstart/concurrent.feature"));
# futures::executor::block_on(AnimalWorld::run("tests/features/book/quickstart/concurrent.feature"));
# }
```

Expand Down Expand Up @@ -410,7 +410,7 @@ fn hungry_cat(world: &mut AnimalWorld, state: String) {
# }
#
# fn main() {
# futures::executor::block_on(AnimalWorld::run("/tests/features/book/quickstart/simple.feature"));
# futures::executor::block_on(AnimalWorld::run("tests/features/book/quickstart/simple.feature"));
# }
```

Expand Down Expand Up @@ -497,7 +497,7 @@ async fn cat_is_fed(world: &mut AnimalWorld) {

#[tokio::main]
async fn main() {
AnimalWorld::run("/tests/features/book/quickstart").await;
AnimalWorld::run("tests/features/book/quickstart").await;
}
```
![record](rec/quickstart_concurrent_async.gif)
Expand Down
4 changes: 2 additions & 2 deletions book/src/writing/asserting.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn cat_is_fed(_: &mut AnimalWorld) {
# #[tokio::main]
# async fn main() {
# AnimalWorld::cucumber()
# .run_and_exit("/tests/features/book/writing/asserting.feature")
# .run_and_exit("tests/features/book/writing/asserting.feature")
# .await;
# }
```
Expand Down Expand Up @@ -131,7 +131,7 @@ fn cat_is_fed(world: &mut AnimalWorld) -> Result<(), &'static str> {
# #[tokio::main]
# async fn main() {
# AnimalWorld::cucumber()
# .run_and_exit("/tests/features/book/writing/asserting.feature")
# .run_and_exit("tests/features/book/writing/asserting.feature")
# .await;
# }
```
Expand Down
2 changes: 1 addition & 1 deletion book/src/writing/background.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async fn cat_is_fed(world: &mut AnimalWorld) {
#
# #[tokio::main]
# async fn main() {
# AnimalWorld::run("/tests/features/book/writing/background.feature").await;
# AnimalWorld::run("tests/features/book/writing/background.feature").await;
# }
```
![record](../rec/writing_background.gif)
Expand Down
8 changes: 4 additions & 4 deletions book/src/writing/capturing.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn feed_cat(world: &mut AnimalWorld) {
#
# #[tokio::main]
# async fn main() {
# AnimalWorld::run("/tests/features/book/writing/capturing.feature").await;
# AnimalWorld::run("tests/features/book/writing/capturing.feature").await;
# }
```
> __NOTE__: We surround the [regex] with `^..$` to ensure an __exact__ match. This is much more useful when adding more and more [step]s, so they won't accidentally interfere with each other.
Expand Down Expand Up @@ -153,7 +153,7 @@ fn feed_cat(world: &mut AnimalWorld, times: u8) {
#
# #[tokio::main]
# async fn main() {
# AnimalWorld::run("/tests/features/book/writing/capturing.feature").await;
# AnimalWorld::run("tests/features/book/writing/capturing.feature").await;
# }
```
![record](../rec/writing_capturing_both.gif)
Expand Down Expand Up @@ -236,7 +236,7 @@ fn feed_cat(world: &mut AnimalWorld, times: u8) {
#
# #[tokio::main]
# async fn main() {
# AnimalWorld::run("/tests/features/book/writing/capturing.feature").await;
# AnimalWorld::run("tests/features/book/writing/capturing.feature").await;
# }
```

Expand Down Expand Up @@ -327,7 +327,7 @@ fn hungry_cat(world: &mut AnimalWorld, state: State) {
#
# #[tokio::main]
# async fn main() {
# AnimalWorld::run("/tests/features/book/writing/capturing.feature").await;
# AnimalWorld::run("tests/features/book/writing/capturing.feature").await;
# }
```

Expand Down
2 changes: 1 addition & 1 deletion book/src/writing/data_tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl World for AnimalWorld {
#
# #[tokio::main]
# async fn main() {
# AnimalWorld::run("/tests/features/book/writing/data_tables.feature").await;
# AnimalWorld::run("tests/features/book/writing/data_tables.feature").await;
# }
```

Expand Down
2 changes: 1 addition & 1 deletion book/src/writing/doc_strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async fn hungry_cat(world: &mut AnimalWorld, step: &Step, state: String) {
# #[tokio::main]
# async fn main() {
# AnimalWorld::cucumber()
# .run_and_exit("/tests/features/book/writing/doc_strings.feature")
# .run_and_exit("tests/features/book/writing/doc_strings.feature")
# .await;
# }
```
Expand Down
2 changes: 1 addition & 1 deletion book/src/writing/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async fn cat_is_fed(world: &mut AnimalWorld) {
#
# #[tokio::main]
# async fn main() {
# AnimalWorld::run("/tests/features/book/writing/languages.feature").await;
# AnimalWorld::run("tests/features/book/writing/languages.feature").await;
# }
```
![record](../rec/writing_languages.gif)
Expand Down
2 changes: 1 addition & 1 deletion book/src/writing/rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async fn cat_is_fed(world: &mut AnimalWorld) {
#
# #[tokio::main]
# async fn main() {
# AnimalWorld::run("/tests/features/book/writing/rule.feature").await;
# AnimalWorld::run("tests/features/book/writing/rule.feature").await;
# }
```
![record](../rec/writing_rule.gif)
Expand Down
2 changes: 1 addition & 1 deletion book/src/writing/scenario_outline.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async fn animal_is_fed(world: &mut AnimalWorld, which: String) {
#
# #[tokio::main]
# async fn main() {
# AnimalWorld::run("/tests/features/book/writing/scenario_outline.feature").await;
# AnimalWorld::run("tests/features/book/writing/scenario_outline.feature").await;
# }
```

Expand Down
2 changes: 1 addition & 1 deletion book/src/writing/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Feature: Animal feature
async fn main() {
AnimalWorld::cucumber()
.fail_on_skipped()
.run_and_exit("/tests/features/book/writing/tags_skip_failed.feature")
.run_and_exit("tests/features/book/writing/tags_skip_failed.feature")
.await;
}
```
Expand Down
4 changes: 2 additions & 2 deletions book/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ cucumber = { version = "0.11", path = "../..", features = ["output-json", "outpu
futures = "0.3"
humantime = "2.1"
once_cell = { version = "1.8", features = ["parking_lot"] }
skeptic = "0.13"
skeptic = "0.13.7"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }

[build-dependencies]
skeptic = "0.13"
skeptic = "0.13.7"

0 comments on commit 644abfc

Please sign in to comment.