Skip to content

Commit a498391

Browse files
committed
show buggy behavior of not trimming newlines in new credential process test
1 parent 852a316 commit a498391

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/testsuite/credential_process.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,3 +695,22 @@ fn alias_builtin_warning() {
695695
)
696696
.run();
697697
}
698+
699+
#[cargo_test]
700+
fn login_token_from_stdin() {
701+
// Test reading a token from stdin, ensuring newlines are trimmed.
702+
let registry = registry::RegistryBuilder::new()
703+
.no_configure_token()
704+
.credential_provider(&[&build_provider("test-cred", r#"{"Ok": {"kind": "login"}}"#)])
705+
.build();
706+
707+
cargo_process("login")
708+
.replace_crates_io(registry.index_url())
709+
.with_stdin("abcdefg\n")
710+
.with_stderr(
711+
r#"[UPDATING] [..]
712+
{"v":1,"registry":{"index-url":"https://github.com/rust-lang/crates.io-index","name":"crates-io"},"kind":"login","token":"abcdefg\n","login-url":"[..]"}
713+
"#,
714+
)
715+
.run();
716+
}

0 commit comments

Comments
 (0)