Skip to content

Commit

Permalink
Add test cases (one xfailed, one not)
Browse files Browse the repository at this point in the history
as per #3601 and #3609
  • Loading branch information
catamorphism committed Jan 3, 2013
1 parent 1bc51f1 commit 1330b1c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/test/compile-fail/issue-3601.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
struct HTMLImageData {
mut image: Option<~str>
}

struct ElementData {
kind: ~ElementKind
}

enum ElementKind {
HTMLImageElement(HTMLImageData)
}

enum NodeKind {
Element(ElementData)
}

enum NodeData = {
kind: ~NodeKind
};

fn main() {
let id = HTMLImageData { image: None };
let ed = ElementData { kind: ~HTMLImageElement(id) };
let n = NodeData({kind : ~Element(ed)});
match n.kind {
~Element(ed) => match ed.kind {
~HTMLImageElement(d) if d.image.is_some() => { true }
},
_ => fail ~"WAT" //~ ERROR wat
};
}
28 changes: 28 additions & 0 deletions src/test/run-pass/issue-3609.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
extern mod std;

use pipes::Chan;

type RingBuffer = ~[float];
type SamplesFn = fn~ (samples: &RingBuffer);

enum Msg
{
GetSamples(~str, SamplesFn), // sample set name, callback which receives samples
}

fn foo(name: ~str, samples_chan: Chan<Msg>) {
do task::spawn
|copy name|
{
let callback: SamplesFn =
|buffer|
{
for uint::range(0, buffer.len())
|i| {error!("%?: %f", i, buffer[i])}
};
samples_chan.send(GetSamples(copy name, callback));
};
}

fn main() {}

0 comments on commit 1330b1c

Please sign in to comment.