std: test-fixes, remove warnings, syntax highlighting for code examples.
This commit is contained in:
@@ -24,7 +24,6 @@ use util::logv;
|
|||||||
|
|
||||||
use core::io;
|
use core::io;
|
||||||
use core::os;
|
use core::os;
|
||||||
use core::str;
|
|
||||||
use core::uint;
|
use core::uint;
|
||||||
use core::vec;
|
use core::vec;
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ use syntax::ast;
|
|||||||
use syntax::ast_map;
|
use syntax::ast_map;
|
||||||
use syntax;
|
use syntax;
|
||||||
|
|
||||||
#[cfg(test)] use core::vec;
|
|
||||||
|
|
||||||
pub struct Ctxt {
|
pub struct Ctxt {
|
||||||
ast: @ast::crate,
|
ast: @ast::crate,
|
||||||
ast_map: ast_map::map
|
ast_map: ast_map::map
|
||||||
|
|||||||
@@ -129,14 +129,12 @@ fn first_sentence_(s: &str) -> ~str {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
match idx {
|
match idx {
|
||||||
Some(idx) if idx > 2u => {
|
Some(idx) if idx > 2u => s.slice(0, idx - 1).to_owned(),
|
||||||
str::to_owned(s.slice(0, idx - 1))
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
if s.ends_with(".") {
|
if s.ends_with(".") {
|
||||||
str::to_owned(s)
|
s.to_owned()
|
||||||
} else {
|
} else {
|
||||||
str::to_owned(s)
|
s.to_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,8 +285,6 @@ mod test {
|
|||||||
use extract::{extract, from_srv};
|
use extract::{extract, from_srv};
|
||||||
use parse;
|
use parse;
|
||||||
|
|
||||||
use core::vec;
|
|
||||||
|
|
||||||
fn mk_doc(source: @str) -> doc::Doc {
|
fn mk_doc(source: @str) -> doc::Doc {
|
||||||
let ast = parse::from_str(source);
|
let ast = parse::from_str(source);
|
||||||
extract(ast, ~"")
|
extract(ast, ~"")
|
||||||
|
|||||||
@@ -537,8 +537,6 @@ mod test {
|
|||||||
use tystr_pass;
|
use tystr_pass;
|
||||||
use unindent_pass;
|
use unindent_pass;
|
||||||
|
|
||||||
use core::str;
|
|
||||||
|
|
||||||
fn render(source: ~str) -> ~str {
|
fn render(source: ~str) -> ~str {
|
||||||
let (srv, doc) = create_doc_srv(source);
|
let (srv, doc) = create_doc_srv(source);
|
||||||
let markdown = write_markdown_str_srv(srv, doc);
|
let markdown = write_markdown_str_srv(srv, doc);
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ mod test {
|
|||||||
use doc;
|
use doc;
|
||||||
use extract;
|
use extract;
|
||||||
use page_pass::run;
|
use page_pass::run;
|
||||||
use core::vec;
|
|
||||||
|
|
||||||
fn mk_doc_(
|
fn mk_doc_(
|
||||||
output_style: config::OutputStyle,
|
output_style: config::OutputStyle,
|
||||||
|
|||||||
@@ -77,8 +77,6 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_prune_hidden_items() {
|
fn should_prune_hidden_items() {
|
||||||
use core::vec;
|
|
||||||
|
|
||||||
let doc = mk_doc(~"#[doc(hidden)] mod a { }");
|
let doc = mk_doc(~"#[doc(hidden)] mod a { }");
|
||||||
assert!(doc.cratemod().mods().is_empty())
|
assert!(doc.cratemod().mods().is_empty())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ mod test {
|
|||||||
use extract;
|
use extract;
|
||||||
use tystr_pass;
|
use tystr_pass;
|
||||||
use prune_private_pass::run;
|
use prune_private_pass::run;
|
||||||
use core::vec;
|
|
||||||
|
|
||||||
fn mk_doc(source: ~str) -> doc::Doc {
|
fn mk_doc(source: ~str) -> doc::Doc {
|
||||||
do astsrv::from_str(copy source) |srv| {
|
do astsrv::from_str(copy source) |srv| {
|
||||||
|
|||||||
@@ -170,9 +170,6 @@ mod test {
|
|||||||
use extract;
|
use extract;
|
||||||
use sectionalize_pass::run;
|
use sectionalize_pass::run;
|
||||||
|
|
||||||
use core::str;
|
|
||||||
use core::vec;
|
|
||||||
|
|
||||||
fn mk_doc(source: ~str) -> doc::Doc {
|
fn mk_doc(source: ~str) -> doc::Doc {
|
||||||
do astsrv::from_str(copy source) |srv| {
|
do astsrv::from_str(copy source) |srv| {
|
||||||
let doc = extract::from_srv(srv.clone(), ~"");
|
let doc = extract::from_srv(srv.clone(), ~"");
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ impl GenericPath for PosixPath {
|
|||||||
fn with_filestem(&self, s: &str) -> PosixPath {
|
fn with_filestem(&self, s: &str) -> PosixPath {
|
||||||
match self.filetype() {
|
match self.filetype() {
|
||||||
None => self.with_filename(s),
|
None => self.with_filename(s),
|
||||||
Some(ref t) => self.with_filename(str::to_owned(s) + *t),
|
Some(ref t) => self.with_filename(s.to_owned() + *t),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,7 +657,7 @@ impl GenericPath for WindowsPath {
|
|||||||
(None, None) => {
|
(None, None) => {
|
||||||
host = None;
|
host = None;
|
||||||
device = None;
|
device = None;
|
||||||
rest = str::to_owned(s);
|
rest = s.to_owned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -729,7 +729,7 @@ impl GenericPath for WindowsPath {
|
|||||||
fn with_filestem(&self, s: &str) -> WindowsPath {
|
fn with_filestem(&self, s: &str) -> WindowsPath {
|
||||||
match self.filetype() {
|
match self.filetype() {
|
||||||
None => self.with_filename(s),
|
None => self.with_filename(s),
|
||||||
Some(ref t) => self.with_filename(str::to_owned(s) + *t),
|
Some(ref t) => self.with_filename(s.to_owned() + *t),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -984,7 +984,7 @@ mod tests {
|
|||||||
fn test_posix_paths() {
|
fn test_posix_paths() {
|
||||||
fn t(wp: &PosixPath, s: &str) {
|
fn t(wp: &PosixPath, s: &str) {
|
||||||
let ss = wp.to_str();
|
let ss = wp.to_str();
|
||||||
let sss = str::to_owned(s);
|
let sss = s.to_owned();
|
||||||
if (ss != sss) {
|
if (ss != sss) {
|
||||||
debug!("got %s", ss);
|
debug!("got %s", ss);
|
||||||
debug!("expected %s", sss);
|
debug!("expected %s", sss);
|
||||||
@@ -1042,7 +1042,7 @@ mod tests {
|
|||||||
fn test_normalize() {
|
fn test_normalize() {
|
||||||
fn t(wp: &PosixPath, s: &str) {
|
fn t(wp: &PosixPath, s: &str) {
|
||||||
let ss = wp.to_str();
|
let ss = wp.to_str();
|
||||||
let sss = str::to_owned(s);
|
let sss = s.to_owned();
|
||||||
if (ss != sss) {
|
if (ss != sss) {
|
||||||
debug!("got %s", ss);
|
debug!("got %s", ss);
|
||||||
debug!("expected %s", sss);
|
debug!("expected %s", sss);
|
||||||
@@ -1105,7 +1105,7 @@ mod tests {
|
|||||||
fn test_windows_paths() {
|
fn test_windows_paths() {
|
||||||
fn t(wp: &WindowsPath, s: &str) {
|
fn t(wp: &WindowsPath, s: &str) {
|
||||||
let ss = wp.to_str();
|
let ss = wp.to_str();
|
||||||
let sss = str::to_owned(s);
|
let sss = s.to_owned();
|
||||||
if (ss != sss) {
|
if (ss != sss) {
|
||||||
debug!("got %s", ss);
|
debug!("got %s", ss);
|
||||||
debug!("expected %s", sss);
|
debug!("expected %s", sss);
|
||||||
|
|||||||
@@ -1432,7 +1432,7 @@ impl<'self> StrSlice<'self> for &'self str {
|
|||||||
*
|
*
|
||||||
* # Example
|
* # Example
|
||||||
*
|
*
|
||||||
* ~~~
|
* ~~~ {.rust}
|
||||||
* assert_eq!("11foo1bar11".trim_chars(&'1'), "foo1bar")
|
* assert_eq!("11foo1bar11".trim_chars(&'1'), "foo1bar")
|
||||||
* assert_eq!("12foo1bar12".trim_chars(& &['1', '2']), "foo1bar")
|
* assert_eq!("12foo1bar12".trim_chars(& &['1', '2']), "foo1bar")
|
||||||
* assert_eq!("123foo1bar123".trim_chars(&|c: char| c.is_digit()), "foo1bar")
|
* assert_eq!("123foo1bar123".trim_chars(&|c: char| c.is_digit()), "foo1bar")
|
||||||
@@ -1451,7 +1451,7 @@ impl<'self> StrSlice<'self> for &'self str {
|
|||||||
*
|
*
|
||||||
* # Example
|
* # Example
|
||||||
*
|
*
|
||||||
* ~~~
|
* ~~~ {.rust}
|
||||||
* assert_eq!("11foo1bar11".trim_left_chars(&'1'), "foo1bar11")
|
* assert_eq!("11foo1bar11".trim_left_chars(&'1'), "foo1bar11")
|
||||||
* assert_eq!("12foo1bar12".trim_left_chars(& &['1', '2']), "foo1bar12")
|
* assert_eq!("12foo1bar12".trim_left_chars(& &['1', '2']), "foo1bar12")
|
||||||
* assert_eq!("123foo1bar123".trim_left_chars(&|c: char| c.is_digit()), "foo1bar123")
|
* assert_eq!("123foo1bar123".trim_left_chars(&|c: char| c.is_digit()), "foo1bar123")
|
||||||
@@ -1473,7 +1473,7 @@ impl<'self> StrSlice<'self> for &'self str {
|
|||||||
*
|
*
|
||||||
* # Example
|
* # Example
|
||||||
*
|
*
|
||||||
* ~~~
|
* ~~~ {.rust}
|
||||||
* assert_eq!("11foo1bar11".trim_right_chars(&'1'), "11foo1bar")
|
* assert_eq!("11foo1bar11".trim_right_chars(&'1'), "11foo1bar")
|
||||||
* assert_eq!("12foo1bar12".trim_right_chars(& &['1', '2']), "12foo1bar")
|
* assert_eq!("12foo1bar12".trim_right_chars(& &['1', '2']), "12foo1bar")
|
||||||
* assert_eq!("123foo1bar123".trim_right_chars(&|c: char| c.is_digit()), "123foo1bar")
|
* assert_eq!("123foo1bar123".trim_right_chars(&|c: char| c.is_digit()), "123foo1bar")
|
||||||
|
|||||||
Reference in New Issue
Block a user