2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
2013-10-23 08:49:18 +00:00
|
|
|
|
2015-01-28 13:34:18 +00:00
|
|
|
#[derive(Debug)]
|
2013-03-21 22:00:29 +00:00
|
|
|
enum Token {
|
2014-10-02 05:10:09 +00:00
|
|
|
Text(String),
|
|
|
|
ETag(Vec<String>, String),
|
|
|
|
UTag(Vec<String>, String),
|
|
|
|
Section(Vec<String>, bool, Vec<Token>, String,
|
|
|
|
String, String, String, String),
|
|
|
|
IncompleteSection(Vec<String>, bool, String, bool),
|
|
|
|
Partial(String, String, String),
|
2013-03-21 22:00:29 +00:00
|
|
|
}
|
2013-05-03 23:25:04 +00:00
|
|
|
|
2013-03-21 22:00:29 +00:00
|
|
|
fn check_strs(actual: &str, expected: &str) -> bool
|
|
|
|
{
|
2014-02-05 22:33:10 +00:00
|
|
|
if actual != expected
|
|
|
|
{
|
|
|
|
println!("Found {}, but expected {}", actual, expected);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
2013-03-21 22:00:29 +00:00
|
|
|
}
|
2013-05-03 23:25:04 +00:00
|
|
|
|
2013-03-27 16:58:28 +00:00
|
|
|
pub fn main()
|
2013-03-21 22:00:29 +00:00
|
|
|
{
|
2014-11-06 08:05:53 +00:00
|
|
|
let t = Token::Text("foo".to_string());
|
|
|
|
let u = Token::Section(vec!["alpha".to_string()],
|
2014-10-02 05:10:09 +00:00
|
|
|
true,
|
|
|
|
vec![t],
|
|
|
|
"foo".to_string(),
|
|
|
|
"foo".to_string(), "foo".to_string(), "foo".to_string(),
|
|
|
|
"foo".to_string());
|
2014-12-20 08:09:35 +00:00
|
|
|
let v = format!("{:?}", u); // this is the line that causes the seg fault
|
2015-03-24 23:54:09 +00:00
|
|
|
assert!(!v.is_empty());
|
2013-03-21 22:00:29 +00:00
|
|
|
}
|