Skip to content

Commit dd0a654

Browse files
committed
---
yaml --- r: 51327 b: refs/heads/incoming c: 15d78fc h: refs/heads/master i: 51325: 2d23090 51323: eb1a693 51319: ea88511 51311: d935bfd 51295: 67f8bde 51263: e45833c 51199: 3ac8141 v: v3
1 parent d1ff631 commit dd0a654

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
@@ -6,7 +6,7 @@ refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 34aaf350c2c38435a3b20d454b17f8fbbd2a1d8a
9+
refs/heads/incoming: 15d78fc398527c5035c092c1c67db600543902d5
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/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)