mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 23:10:30 +00:00
Fix integration tests
This commit is contained in:
parent
dc086c6bf1
commit
8b43d79257
3 changed files with 59 additions and 7 deletions
49
Cargo.lock
generated
49
Cargo.lock
generated
|
@ -225,6 +225,22 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.23"
|
||||
|
@ -339,6 +355,12 @@ version = "0.2.155"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.12"
|
||||
|
@ -513,6 +535,19 @@ dependencies = [
|
|||
"bitflags 2.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustlings"
|
||||
version = "6.1.0"
|
||||
|
@ -526,6 +561,7 @@ dependencies = [
|
|||
"rustlings-macros",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
|
@ -697,6 +733,19 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.8"
|
||||
|
|
|
@ -57,6 +57,9 @@ serde_json = "1.0.122"
|
|||
serde.workspace = true
|
||||
toml_edit.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.12.0"
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
|
||||
|
|
|
@ -155,28 +155,28 @@ fn hint() {
|
|||
|
||||
#[test]
|
||||
fn init() {
|
||||
let _ = fs::remove_dir_all("tests/rustlings");
|
||||
let test_dir = tempfile::TempDir::new().unwrap();
|
||||
let initialized_dir = test_dir.path().join("rustlings");
|
||||
let test_dir = test_dir.path().to_str().unwrap();
|
||||
|
||||
Cmd::default().current_dir("tests").fail();
|
||||
Cmd::default().current_dir(test_dir).fail();
|
||||
|
||||
Cmd::default()
|
||||
.current_dir("tests")
|
||||
.current_dir(test_dir)
|
||||
.args(&["init"])
|
||||
.success();
|
||||
|
||||
// Running `init` after a successful initialization.
|
||||
Cmd::default()
|
||||
.current_dir("tests")
|
||||
.current_dir(test_dir)
|
||||
.args(&["init"])
|
||||
.output(PartialStderr("`cd rustlings`"))
|
||||
.fail();
|
||||
|
||||
// Running `init` in the initialized directory.
|
||||
Cmd::default()
|
||||
.current_dir("tests/rustlings")
|
||||
.current_dir(initialized_dir.to_str().unwrap())
|
||||
.args(&["init"])
|
||||
.output(PartialStderr("already initialized"))
|
||||
.fail();
|
||||
|
||||
fs::remove_dir_all("tests/rustlings").unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue