]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-3556.rs
auto merge of #13600 : brandonw/rust/master, r=brson
[rust.git] / src / test / run-pass / issue-3556.rs
1 // Copyright 2013 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 #![feature(managed_boxes)]
12
13 enum Token {
14     Text(@~str),
15     ETag(@Vec<~str> , @~str),
16     UTag(@Vec<~str> , @~str),
17     Section(@Vec<~str> , bool, @Vec<Token> , @~str, @~str, @~str, @~str, @~str),
18     IncompleteSection(@Vec<~str> , bool, @~str, bool),
19     Partial(@~str, @~str, @~str),
20 }
21
22 fn check_strs(actual: &str, expected: &str) -> bool
23 {
24     if actual != expected
25     {
26         println!("Found {}, but expected {}", actual, expected);
27         return false;
28     }
29     return true;
30 }
31
32 pub fn main()
33 {
34 // assert!(check_strs(fmt!("%?", Text(@~"foo")), "Text(@~\"foo\")"));
35 // assert!(check_strs(fmt!("%?", ETag(@~[~"foo"], @~"bar")), "ETag(@~[ ~\"foo\" ], @~\"bar\")"));
36
37     let t = Text(@~"foo");
38     let u = Section(@vec!(~"alpha"), true, @vec!(t), @~"foo", @~"foo", @~"foo", @~"foo", @~"foo");
39     let v = format!("{:?}", u);    // this is the line that causes the seg fault
40     assert!(v.len() > 0);
41 }