-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test cases (one xfailed, one not)
- Loading branch information
1 parent
1bc51f1
commit 1330b1c
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} | ||
|