Add test cases (one xfailed, one not)

as per #3601 and #3609
This commit is contained in:
Tim Chevalier 2013-01-03 14:55:46 -08:00
parent 1bc51f1728
commit 1330b1cdf5
2 changed files with 59 additions and 0 deletions

View File

@ -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
};
}

View File

@ -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() {}