Skip to content

Commit 981b314

Browse files
committed
---
yaml --- r: 44810 b: refs/heads/master c: 6ebc761 h: refs/heads/master v: v3
1 parent e383483 commit 981b314

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: dbbdca31b45997604d4bf99662cb32939c838149
2+
refs/heads/master: 6ebc761f99149b47524664b6625ee36e04449baa
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/src/libstd/sha1.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,11 @@ pub fn sha1() -> Sha1 {
251251
let rr = mk_result(self);
252252
let mut s = ~"";
253253
for vec::each(rr) |b| {
254-
s += uint::to_str_radix(*b as uint, 16u);
254+
let hex = uint::to_str_radix(*b as uint, 16u);
255+
if hex.len() == 1 {
256+
s += "0";
257+
}
258+
s += hex;
255259
}
256260
return s;
257261
}
@@ -283,6 +287,7 @@ mod tests {
283287
struct Test {
284288
input: ~str,
285289
output: ~[u8],
290+
output_str: ~str,
286291
}
287292

288293
fn a_million_letter_a() -> ~str {
@@ -306,6 +311,7 @@ mod tests {
306311
0x78u8, 0x50u8, 0xC2u8, 0x6Cu8,
307312
0x9Cu8, 0xD0u8, 0xD8u8, 0x9Du8,
308313
],
314+
output_str: ~"a9993e364706816aba3e25717850c26c9cd0d89d"
309315
},
310316
Test {
311317
input:
@@ -318,6 +324,7 @@ mod tests {
318324
0xF9u8, 0x51u8, 0x29u8, 0xE5u8,
319325
0xE5u8, 0x46u8, 0x70u8, 0xF1u8,
320326
],
327+
output_str: ~"84983e441c3bd26ebaae4aa1f95129e5e54670f1"
321328
},
322329
Test {
323330
input: a_million_letter_a(),
@@ -328,6 +335,7 @@ mod tests {
328335
0xDBu8, 0xADu8, 0x27u8, 0x31u8,
329336
0x65u8, 0x34u8, 0x01u8, 0x6Fu8,
330337
],
338+
output_str: ~"34aa973cd4c4daa4f61eeb2bdbad27316534016f"
331339
},
332340
];
333341
// Examples from wikipedia
@@ -342,6 +350,7 @@ mod tests {
342350
0xbbu8, 0x76u8, 0xe7u8, 0x39u8,
343351
0x1bu8, 0x93u8, 0xebu8, 0x12u8,
344352
],
353+
output_str: ~"2fd4e1c67a2d28fced849ee1bb76e7391b93eb12",
345354
},
346355
Test {
347356
input: ~"The quick brown fox jumps over the lazy cog",
@@ -352,6 +361,7 @@ mod tests {
352361
0x0bu8, 0xd1u8, 0x7du8, 0x9bu8,
353362
0x10u8, 0x0du8, 0xb4u8, 0xb3u8,
354363
],
364+
output_str: ~"de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3",
355365
},
356366
];
357367
let tests = fips_180_1_tests + wikipedia_tests;
@@ -373,6 +383,11 @@ mod tests {
373383
sh.input_str(t.input);
374384
let out = sh.result();
375385
check_vec_eq(t.output, out);
386+
387+
let out_str = sh.result_str();
388+
assert(out_str.len() == 40);
389+
assert(out_str == t.output_str);
390+
376391
sh.reset();
377392
}
378393

@@ -389,6 +404,11 @@ mod tests {
389404
}
390405
let out = sh.result();
391406
check_vec_eq(t.output, out);
407+
408+
let out_str = sh.result_str();
409+
assert(out_str.len() == 40);
410+
assert(out_str == t.output_str);
411+
392412
sh.reset();
393413
}
394414
}

trunk/src/test/compile-fail/issue-3601.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// xfail-test
1112
struct HTMLImageData {
1213
image: Option<~str>
1314
}
@@ -24,19 +25,18 @@ enum NodeKind {
2425
Element(ElementData)
2526
}
2627

27-
struct NodeData {
28+
enum NodeData = {
2829
kind: ~NodeKind
29-
}
30+
};
3031

3132
fn main() {
3233
let mut id = HTMLImageData { image: None };
3334
let ed = ElementData { kind: ~HTMLImageElement(id) };
34-
let n = NodeData {kind : ~Element(ed)};
35-
// n.b. span could be better
35+
let n = NodeData({kind : ~Element(ed)});
3636
match n.kind {
37-
~Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns
38-
~HTMLImageElement(ref d) if d.image.is_some() => { true }
37+
~Element(ed) => match ed.kind {
38+
~HTMLImageElement(d) if d.image.is_some() => { true }
3939
},
40-
_ => fail!(~"WAT") //~ ERROR unreachable pattern
40+
_ => fail!(~"WAT") //~ ERROR wat
4141
};
4242
}

0 commit comments

Comments
 (0)