Skip to content

Instantly share code, notes, and snippets.

@burg
Created September 26, 2012 23:08
Show Gist options
  • Save burg/3791204 to your computer and use it in GitHub Desktop.
Save burg/3791204 to your computer and use it in GitHub Desktop.
test case for mozilla/rust issue #3601
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"
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment