use super::{ErrorCodes, LangString, Markdown, MarkdownHtml, IdMap};
use super::plain_summary_line;
use std::cell::RefCell;
- use syntax::edition::Edition;
+ use syntax::edition::{Edition, DEFAULT_EDITION};
#[test]
fn test_lang_string_parse() {
fn test_header() {
fn t(input: &str, expect: &str) {
let mut map = IdMap::new();
- let output = Markdown(input, &[], RefCell::new(&mut map), ErrorCodes::Yes).to_string();
+ let output = Markdown(input, &[], RefCell::new(&mut map),
+ ErrorCodes::Yes, DEFAULT_EDITION).to_string();
assert_eq!(output, expect, "original: {}", input);
}
fn test_header_ids_multiple_blocks() {
let mut map = IdMap::new();
fn t(map: &mut IdMap, input: &str, expect: &str) {
- let output = Markdown(input, &[], RefCell::new(map), ErrorCodes::Yes).to_string();
+ let output = Markdown(input, &[], RefCell::new(map),
+ ErrorCodes::Yes, DEFAULT_EDITION).to_string();
assert_eq!(output, expect, "original: {}", input);
}
fn test_markdown_html_escape() {
fn t(input: &str, expect: &str) {
let mut idmap = IdMap::new();
- let output = MarkdownHtml(input, RefCell::new(&mut idmap), ErrorCodes::Yes).to_string();
+ let output = MarkdownHtml(input, RefCell::new(&mut idmap),
+ ErrorCodes::Yes, DEFAULT_EDITION).to_string();
assert_eq!(output, expect, "original: {}", input);
}
#[cfg(test)]
mod tests {
use super::{TestOptions, make_test};
+ use syntax::edition::DEFAULT_EDITION;
#[test]
fn make_test_basic() {
fn main() {
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, None, false, &opts);
+ let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 2));
}
fn main() {
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, Some("asdf"), false, &opts);
+ let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 2));
}
use asdf::qwop;
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, Some("asdf"), false, &opts);
+ let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 3));
}
use asdf::qwop;
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, Some("asdf"), false, &opts);
+ let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 2));
}
use std::*;
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, Some("std"), false, &opts);
+ let output = make_test(input, Some("std"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 2));
}
use asdf::qwop;
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, Some("asdf"), false, &opts);
+ let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 2));
}
use asdf::qwop;
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, Some("asdf"), false, &opts);
+ let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 2));
}
use asdf::qwop;
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, Some("asdf"), false, &opts);
+ let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 3));
// Adding more will also bump the returned line offset.
use asdf::qwop;
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, Some("asdf"), false, &opts);
+ let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 4));
}
fn main() {
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, None, false, &opts);
+ let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 2));
}
fn main() {
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, None, false, &opts);
+ let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 1));
}
fn main() {
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, None, false, &opts);
+ let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 2));
}
"#![allow(unused)]
//Ceci n'est pas une `fn main`
assert_eq!(2+2, 4);".to_string();
- let output = make_test(input, None, true, &opts);
+ let output = make_test(input, None, true, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 1));
}
"fn main() {
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, None, false, &opts);
+ let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 1));
}
assert_eq!(2+2, 4);
}".to_string();
- let output = make_test(input, None, false, &opts);
+ let output = make_test(input, None, false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 2));
let input =
assert_eq!(asdf::foo, 4);
}".to_string();
- let output = make_test(input, Some("asdf"), false, &opts);
+ let output = make_test(input, Some("asdf"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 3));
}
fn main() {}
}".to_string();
- let output = make_test(input, Some("my_crate"), false, &opts);
+ let output = make_test(input, Some("my_crate"), false, &opts, DEFAULT_EDITION);
assert_eq!(output, (expected, 1));
}
}