diff options
| author | QuietMisdreavus <grey@quietmisdreavus.net> | 2019-04-18 12:23:54 -0500 |
|---|---|---|
| committer | QuietMisdreavus <grey@quietmisdreavus.net> | 2019-05-06 15:20:18 -0500 |
| commit | 5b167bf4bbdff169ca735476e66fdf9b4e6501fd (patch) | |
| tree | 82406cbf939d4cb87eb5c124b388bb0a4dac276b /src | |
| parent | a6d26eb053e9c56fdc9d9e20a2952041a165e559 (diff) | |
| download | rust-5b167bf4bbdff169ca735476e66fdf9b4e6501fd.tar.gz rust-5b167bf4bbdff169ca735476e66fdf9b4e6501fd.zip | |
update rustdoc unit tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 11 | ||||
| -rw-r--r-- | src/librustdoc/test.rs | 35 |
2 files changed, 25 insertions, 21 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 5f450fcf6fc..df01ac2f444 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -1050,7 +1050,7 @@ mod tests { 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() { @@ -1102,7 +1102,8 @@ mod tests { 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); } @@ -1124,7 +1125,8 @@ mod tests { 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); } @@ -1161,7 +1163,8 @@ mod tests { 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); } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 7a9b82c7165..268f0602d48 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -884,6 +884,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirCollector<'a, 'hir> { #[cfg(test)] mod tests { use super::{TestOptions, make_test}; + use syntax::edition::DEFAULT_EDITION; #[test] fn make_test_basic() { @@ -896,7 +897,7 @@ mod tests { 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)); } @@ -912,7 +913,7 @@ assert_eq!(2+2, 4); 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)); } @@ -931,7 +932,7 @@ fn main() { 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)); } @@ -953,7 +954,7 @@ fn main() { 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)); } @@ -972,7 +973,7 @@ fn main() { 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)); } @@ -992,7 +993,7 @@ fn main() { 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)); } @@ -1010,7 +1011,7 @@ fn main() { 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)); } @@ -1030,7 +1031,7 @@ fn main() { 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. @@ -1043,7 +1044,7 @@ fn main() { 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)); } @@ -1061,7 +1062,7 @@ assert_eq!(2+2, 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)); } @@ -1078,7 +1079,7 @@ assert_eq!(2+2, 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, 1)); } @@ -1095,7 +1096,7 @@ assert_eq!(2+2, 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)); } @@ -1110,7 +1111,7 @@ assert_eq!(2+2, 4);"; "#![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)); } @@ -1125,7 +1126,7 @@ assert_eq!(2+2, 4);".to_string(); "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)); } @@ -1144,7 +1145,7 @@ 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)); let input = @@ -1159,7 +1160,7 @@ fn main() { 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)); } @@ -1178,7 +1179,7 @@ test_wrapper! { 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)); } } |
