Skip to content

Commit be41bfc

Browse files
committed
---
yaml --- r: 50637 b: refs/heads/try c: 15d78fc h: refs/heads/master i: 50635: b40bac3 v: v3
1 parent 5b52f37 commit be41bfc

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
5-
refs/heads/try: 34aaf350c2c38435a3b20d454b17f8fbbd2a1d8a
5+
refs/heads/try: 15d78fc398527c5035c092c1c67db600543902d5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

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