Skip to content

Commit 9018c84

Browse files
committed
---
yaml --- r: 49885 b: refs/heads/auto c: 15d78fc h: refs/heads/master i: 49883: 0170b0d v: v3
1 parent 1a905cc commit 9018c84

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
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 34aaf350c2c38435a3b20d454b17f8fbbd2a1d8a
17+
refs/heads/auto: 15d78fc398527c5035c092c1c67db600543902d5
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

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