Skip to content

Commit 7a8dd74

Browse files
committed
---
yaml --- r: 53813 b: refs/heads/dist-snap c: 15d78fc h: refs/heads/master i: 53811: e8b5925 v: v3
1 parent d4b2fdc commit 7a8dd74

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 34aaf350c2c38435a3b20d454b17f8fbbd2a1d8a
10+
refs/heads/dist-snap: 15d78fc398527c5035c092c1c67db600543902d5
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libstd/getopts.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ pub fn opt_count(mm: &Matches, nm: &str) -> uint {
372372
pub fn opts_present(mm: &Matches, names: &[~str]) -> bool {
373373
for vec::each(names) |nm| {
374374
match find_opt(mm.opts, mkname(*nm)) {
375-
Some(_) => return true,
376-
None => ()
377-
}
375+
Some(id) if !mm.vals[id].is_empty() => return true,
376+
_ => (),
377+
};
378378
}
379379
false
380380
}
@@ -1177,7 +1177,7 @@ mod tests {
11771177
#[test]
11781178
pub fn test_multi() {
11791179
let args = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"];
1180-
let opts = ~[optopt(~"e"), optopt(~"encrypt")];
1180+
let opts = ~[optopt(~"e"), optopt(~"encrypt"), optopt(~"f")];
11811181
let matches = &match getopts(args, opts) {
11821182
result::Ok(m) => m,
11831183
result::Err(_) => fail!()
@@ -1186,6 +1186,7 @@ mod tests {
11861186
fail_unless!(opts_present(matches, ~[~"encrypt"]));
11871187
fail_unless!(opts_present(matches, ~[~"encrypt", ~"e"]));
11881188
fail_unless!(opts_present(matches, ~[~"e", ~"encrypt"]));
1189+
fail_unless!(!opts_present(matches, ~[~"f"]));
11891190
fail_unless!(!opts_present(matches, ~[~"thing"]));
11901191
fail_unless!(!opts_present(matches, ~[]));
11911192

0 commit comments

Comments
 (0)