diff options
| author | Jack O'Connor <oconnor663@gmail.com> | 2018-08-27 13:25:58 -0400 |
|---|---|---|
| committer | Jack O'Connor <oconnor663@gmail.com> | 2018-08-27 14:58:14 -0400 |
| commit | 8486efaf924dae203faa25b4d1965759417eb2f5 (patch) | |
| tree | 11aaa957941fd7295038e7bf1cbd75310c9909b3 /src/libstd/sys/unix/os.rs | |
| parent | 8785e348ba6b9d43ffd8ce4b1a59059cbce6334c (diff) | |
| download | rust-8486efaf924dae203faa25b4d1965759417eb2f5.tar.gz rust-8486efaf924dae203faa25b4d1965759417eb2f5.zip | |
fix a typo: taget_env -> target_env
This typo was introduced in https://github.com/rust-lang/rust/pull/47334. A couple tests bitrotted as a result, so we fix those too, and move them to a more sensible place.
Diffstat (limited to 'src/libstd/sys/unix/os.rs')
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index f8f0bbd5bc2..971e6501c2c 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -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)); + } + } +} |
