-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: split cli/tests to separate crate, remove test-fakes feature (…
…PoC) The goal is to remove the crate-cycle: `jj-cli --(dev)--> jj-cli`. Since there's no way to express binary dependency in Cargo.toml, all binaries which the tests depend on should have to be built within the same crate. I put Cargo.toml in cli/tests so the directory structure looks familiar. One big caveat: since we build a separate "jj" binary for tests, the production "jj" binary is no longer covered by these tests. We might want to leave a couple of tests in jj-cli to ensure that the real "jj" binary works.
- Loading branch information
Showing
5 changed files
with
86 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,6 @@ include = [ | |
"/examples/", | ||
"/src/", | ||
"/docs/**", | ||
"/testing/", | ||
"/tests/", | ||
"!*.pending-snap", | ||
"!*.snap*", | ||
"/tests/[email protected]" | ||
|
@@ -30,24 +28,6 @@ include = [ | |
name = "jj" | ||
path = "src/main.rs" | ||
|
||
[[bin]] | ||
name = "fake-editor" | ||
path = "testing/fake-editor.rs" | ||
required-features = ["test-fakes"] | ||
|
||
[[bin]] | ||
name = "fake-diff-editor" | ||
path = "testing/fake-diff-editor.rs" | ||
required-features = ["test-fakes"] | ||
|
||
[[bin]] | ||
name = "fake-formatter" | ||
path = "testing/fake-formatter.rs" | ||
required-features = ["test-fakes"] | ||
|
||
[[test]] | ||
name = "runner" | ||
|
||
[dependencies] | ||
bstr = { workspace = true } | ||
chrono = { workspace = true } | ||
|
@@ -97,20 +77,15 @@ libc = { workspace = true } | |
|
||
[dev-dependencies] | ||
anyhow = { workspace = true } | ||
assert_cmd = { workspace = true } | ||
assert_matches = { workspace = true } | ||
async-trait = { workspace = true } | ||
insta = { workspace = true } | ||
test-case = { workspace = true } | ||
testutils = { workspace = true } | ||
# https://github.com/rust-lang/cargo/issues/2911#issuecomment-1483256987 | ||
jj-cli = { path = ".", features = ["test-fakes"], default-features = false } | ||
|
||
[features] | ||
default = ["watchman"] | ||
bench = ["dep:criterion"] | ||
packaging = [] | ||
test-fakes = ["jj-lib/testing"] | ||
vendored-openssl = ["git2/vendored-openssl", "jj-lib/vendored-openssl"] | ||
watchman = ["jj-lib/watchman"] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[package] | ||
name = "jj-cli-tests" | ||
description = "Integration tests for the jj-cli crate" | ||
autotests = false | ||
publish = false | ||
|
||
version = { workspace = true } | ||
edition = { workspace = true } | ||
rust-version = { workspace = true } | ||
license = { workspace = true } | ||
homepage = { workspace = true } | ||
repository = { workspace = true } | ||
documentation = { workspace = true } | ||
readme = { workspace = true } | ||
|
||
# FIXME: switch to custom main.rs and remove build.rs | ||
build = "../build.rs" | ||
|
||
[[bin]] | ||
name = "jj" | ||
path = "../src/main.rs" | ||
|
||
# FIXME: move ../testing under .? | ||
[[bin]] | ||
name = "fake-diff-editor" | ||
path = "../testing/fake-diff-editor.rs" | ||
|
||
[[bin]] | ||
name = "fake-editor" | ||
path = "../testing/fake-editor.rs" | ||
|
||
[[bin]] | ||
name = "fake-formatter" | ||
path = "../testing/fake-formatter.rs" | ||
|
||
[[test]] | ||
name = "runner" | ||
path = "runner.rs" | ||
|
||
[dependencies] | ||
clap = { workspace = true } | ||
itertools = { workspace = true } | ||
jj-cli = { workspace = true } | ||
|
||
[dev-dependencies] | ||
assert_cmd = { workspace = true } | ||
chrono = { workspace = true } | ||
dunce = { workspace = true } | ||
futures = { workspace = true } | ||
git2 = { workspace = true } | ||
indoc = { workspace = true } | ||
insta = { workspace = true } | ||
jj-lib = { workspace = true, features = ["testing"] } | ||
regex = { workspace = true } | ||
tempfile = { workspace = true } | ||
test-case = { workspace = true } | ||
testutils = { workspace = true } | ||
|
||
[lints] | ||
workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters