Skip to content

Commit

Permalink
Rollup merge of rust-lang#53743 - oconnor663:target_env, r=kennytm
Browse files Browse the repository at this point in the history
fix a typo: taget_env -> target_env

This typo was introduced in rust-lang#47334. A couple tests bitrotted as a result, so we fix those too, and move them to a more sensible place.

Is there some lint we could turn on that would've caught this? It's a drag that cfg typos can silently pass through the compiler.
  • Loading branch information
pietroalbini authored Aug 29, 2018
2 parents ce12f32 + 8486efa commit e1a0fe5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
27 changes: 0 additions & 27 deletions src/libstd/sys/unix/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,30 +395,3 @@ fn on_resolver_failure() {

#[cfg(not(target_env = "gnu"))]
fn on_resolver_failure() {}

#[cfg(all(test, taget_env = "gnu"))]
mod test {
use super::*;

#[test]
fn test_res_init() {
// This mostly just tests that the weak linkage doesn't panic wildly...
res_init_if_glibc_before_2_26().unwrap();
}

#[test]
fn test_parse_glibc_version() {
let cases = [
("0.0", Some((0, 0))),
("01.+2", Some((1, 2))),
("3.4.5.six", Some((3, 4))),
("1", None),
("1.-2", None),
("1.foo", None),
("foo.1", None),
];
for &(version_str, parsed) in cases.iter() {
assert_eq!(parsed, parse_glibc_version(version_str));
}
}
}
27 changes: 27 additions & 0 deletions src/libstd/sys/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,30 @@ fn parse_glibc_version(version: &str) -> Option<(usize, usize)> {
_ => None
}
}

#[cfg(all(test, target_env = "gnu"))]
mod test {
use super::*;

#[test]
fn test_glibc_version() {
// This mostly just tests that the weak linkage doesn't panic wildly...
glibc_version();
}

#[test]
fn test_parse_glibc_version() {
let cases = [
("0.0", Some((0, 0))),
("01.+2", Some((1, 2))),
("3.4.5.six", Some((3, 4))),
("1", None),
("1.-2", None),
("1.foo", None),
("foo.1", None),
];
for &(version_str, parsed) in cases.iter() {
assert_eq!(parsed, parse_glibc_version(version_str));
}
}
}

0 comments on commit e1a0fe5

Please sign in to comment.