Skip to content

Commit d55dbc4

Browse files
committed
Auto merge of #3424 - matklad:naming-things, r=alexcrichton
Minor, more explicit names Ultraminor renaming. Have to look at this tests because it fails if you link with older libgit.
2 parents 55d6678 + 8370aae commit d55dbc4

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

tests/build-auth.rs

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use hamcrest::assert_that;
1616
// Test that HTTP auth is offered from `credential.helper`
1717
#[test]
1818
fn http_auth_offered() {
19-
let a = TcpListener::bind("127.0.0.1:0").unwrap();
20-
let addr = a.local_addr().unwrap();
19+
let server = TcpListener::bind("127.0.0.1:0").unwrap();
20+
let addr = server.local_addr().unwrap();
2121

2222
fn headers(rdr: &mut BufRead) -> HashSet<String> {
2323
let valid = ["GET", "Authorization", "Accept", "User-Agent"];
@@ -31,9 +31,9 @@ fn http_auth_offered() {
3131
}
3232

3333
let t = thread::spawn(move|| {
34-
let mut s = BufStream::new(a.accept().unwrap().0);
35-
let req = headers(&mut s);
36-
s.write_all(b"\
34+
let mut conn = BufStream::new(server.accept().unwrap().0);
35+
let req = headers(&mut conn);
36+
conn.write_all(b"\
3737
HTTP/1.1 401 Unauthorized\r\n\
3838
WWW-Authenticate: Basic realm=\"wheee\"\r\n
3939
\r\n\
@@ -43,11 +43,11 @@ fn http_auth_offered() {
4343
"Accept: */*",
4444
"User-Agent: git/1.0 (libgit2 0.24.0)",
4545
].into_iter().map(|s| s.to_string()).collect());
46-
drop(s);
46+
drop(conn);
4747

48-
let mut s = BufStream::new(a.accept().unwrap().0);
49-
let req = headers(&mut s);
50-
s.write_all(b"\
48+
let mut conn = BufStream::new(server.accept().unwrap().0);
49+
let req = headers(&mut conn);
50+
conn.write_all(b"\
5151
HTTP/1.1 401 Unauthorized\r\n\
5252
WWW-Authenticate: Basic realm=\"wheee\"\r\n
5353
\r\n\
@@ -124,13 +124,13 @@ To learn more, run the command again with --verbose.
124124
// Boy, sure would be nice to have a TLS implementation in rust!
125125
#[test]
126126
fn https_something_happens() {
127-
let a = TcpListener::bind("127.0.0.1:0").unwrap();
128-
let addr = a.local_addr().unwrap();
127+
let server = TcpListener::bind("127.0.0.1:0").unwrap();
128+
let addr = server.local_addr().unwrap();
129129
let t = thread::spawn(move|| {
130-
let mut s = a.accept().unwrap().0;
131-
drop(s.write(b"1234"));
132-
drop(s.shutdown(std::net::Shutdown::Write));
133-
drop(s.read(&mut [0; 16]));
130+
let mut conn = server.accept().unwrap().0;
131+
drop(conn.write(b"1234"));
132+
drop(conn.shutdown(std::net::Shutdown::Write));
133+
drop(conn.read(&mut [0; 16]));
134134
});
135135

136136
let p = project("foo")
@@ -152,10 +152,8 @@ fn https_something_happens() {
152152
assert_that(p.cargo_process("build").arg("-v"),
153153
execs().with_status(101).with_stderr_contains(&format!("\
154154
[UPDATING] git repository `https://{addr}/foo/bar`
155-
",
156-
addr = addr,
157-
))
158-
.with_stderr_contains(&format!("\
155+
", addr = addr))
156+
.with_stderr_contains(&format!("\
159157
Caused by:
160158
{errmsg}
161159
",
@@ -176,10 +174,10 @@ Caused by:
176174
// Boy, sure would be nice to have an SSH implementation in rust!
177175
#[test]
178176
fn ssh_something_happens() {
179-
let a = TcpListener::bind("127.0.0.1:0").unwrap();
180-
let addr = a.local_addr().unwrap();
177+
let server = TcpListener::bind("127.0.0.1:0").unwrap();
178+
let addr = server.local_addr().unwrap();
181179
let t = thread::spawn(move|| {
182-
drop(a.accept().unwrap());
180+
drop(server.accept().unwrap());
183181
});
184182

185183
let p = project("foo")
@@ -197,10 +195,8 @@ fn ssh_something_happens() {
197195
assert_that(p.cargo_process("build").arg("-v"),
198196
execs().with_status(101).with_stderr_contains(&format!("\
199197
[UPDATING] git repository `ssh://{addr}/foo/bar`
200-
",
201-
addr = addr,
202-
))
203-
.with_stderr_contains("\
198+
", addr = addr))
199+
.with_stderr_contains("\
204200
Caused by:
205201
[[..]] Failed to start SSH session: Failed getting banner
206202
"));

0 commit comments

Comments
 (0)