Skip to content

Commit b3337a9

Browse files
committed
Reenable ignored test and add run-pass test.
1 parent ad0be00 commit b3337a9

File tree

2 files changed

+96
-1
lines changed

2 files changed

+96
-1
lines changed

src/libserialize/json.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,6 @@ mod tests {
27952795
}
27962796
}
27972797
#[test]
2798-
#[ignore] // FIXME(#15763)
27992798
fn test_decode_errors_struct() {
28002799
check_err::<DecodeStruct>("[]", ExpectedError("Object".to_string(), "[]".to_string()));
28012800
check_err::<DecodeStruct>("{\"x\": true, \"y\": true, \"z\": \"\", \"w\": []}",

src/test/run-pass/issue-15763.rs

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
12+
#[deriving(PartialEq, Show)]
13+
struct Bar {
14+
x: int
15+
}
16+
impl Drop for Bar {
17+
fn drop(&mut self) {
18+
assert_eq!(self.x, 22);
19+
}
20+
}
21+
22+
#[deriving(PartialEq, Show)]
23+
struct Foo {
24+
x: Bar,
25+
a: int
26+
}
27+
28+
fn foo() -> Result<Foo, int> {
29+
return Ok(Foo {
30+
x: Bar { x: 22 },
31+
a: return Err(32)
32+
});
33+
}
34+
35+
fn baz() -> Result<Foo, int> {
36+
Ok(Foo {
37+
x: Bar { x: 22 },
38+
a: return Err(32)
39+
})
40+
}
41+
42+
// explicit immediate return
43+
fn aa() -> int {
44+
return 3;
45+
}
46+
47+
// implicit immediate return
48+
fn bb() -> int {
49+
3
50+
}
51+
52+
// implicit outptr return
53+
fn cc() -> Result<int, int> {
54+
Ok(3)
55+
}
56+
57+
// explicit outptr return
58+
fn dd() -> Result<int, int> {
59+
return Ok(3);
60+
}
61+
62+
trait A {
63+
fn aaa(self) -> int {
64+
3
65+
}
66+
fn bbb(self) -> int {
67+
return 3;
68+
}
69+
fn ccc(self) -> Result<int, int> {
70+
Ok(3)
71+
}
72+
fn ddd(self) -> Result<int, int> {
73+
return Ok(3);
74+
}
75+
}
76+
77+
impl A for int {}
78+
79+
fn main() {
80+
assert_eq!(foo(), Err(32));
81+
assert_eq!(baz(), Err(32));
82+
83+
assert_eq!(aa(), 3);
84+
assert_eq!(bb(), 3);
85+
assert_eq!(cc().unwrap(), 3);
86+
assert_eq!(dd().unwrap(), 3);
87+
88+
let i = box 32i as Box<A>;
89+
assert_eq!(i.aaa(), 3);
90+
let i = box 32i as Box<A>;
91+
assert_eq!(i.bbb(), 3);
92+
let i = box 32i as Box<A>;
93+
assert_eq!(i.ccc().unwrap(), 3);
94+
let i = box 32i as Box<A>;
95+
assert_eq!(i.ddd().unwrap(), 3);
96+
}

0 commit comments

Comments
 (0)