text: *const hoedown_buffer,
lang: *const hoedown_buffer,
data: *const hoedown_renderer_data,
- _line: libc::size_t) {
+ line: libc::size_t) {
unsafe {
if text.is_null() { return }
let block_info = if lang.is_null() {
let lines = text.lines().map(|l| {
stripped_filtered_line(l).unwrap_or(l)
});
+ let text = lines.collect::<Vec<&str>>().join("\n");
let filename = tests.get_filename();
if tests.render_type == RenderType::Hoedown {
- let text = (*text).as_bytes();
- let text = str::from_utf8(text).unwrap();
- let lines = text.lines().map(|l| {
- stripped_filtered_line(l).unwrap_or(l)
- });
- let text = lines.collect::<Vec<&str>>().join("\n");
+ let line = tests.get_line() + line;
tests.add_test(text.to_owned(),
block_info.should_panic, block_info.no_run,
block_info.ignore, block_info.test_harness,
block_info.compile_fail, block_info.error_codes,
line, filename);
} else {
- tests.add_old_test(lines.collect::<Vec<&str>>().join("\n"), filename);
+ tests.add_old_test(text, filename);
}
}
}
as_test_harness: bool, compile_fail: bool, error_codes: Vec<String>,
line: usize, filename: String) {
let name = self.generate_name(line, &filename);
+ // to be removed when hoedown is removed
if self.render_type == RenderType::Pulldown {
let name_beg = self.generate_name_beginning(&filename);
let mut found = false;
- // to be removed when hoedown is removed
let test = test.trim().to_owned();
if let Some(entry) = self.old_tests.get_mut(&name_beg) {
found = entry.remove_item(&test).is_some();
}
if !found {
let _ = writeln!(&mut io::stderr(),
- "WARNING: {} Code block is not currently run as a test, but will in \
- future versions of rustdoc. Please ensure this code block is a \
- runnable test, or use the `ignore` directive.",
+ "WARNING: {} Code block is not currently run as a test, but will \
+ in future versions of rustdoc. Please ensure this code block is \
+ a runnable test, or use the `ignore` directive.",
name);
return
}