Skip to content

Commit

Permalink
[beta] group old_tests by just the filename, not the test name
Browse files Browse the repository at this point in the history
  • Loading branch information
QuietMisdreavus committed Feb 21, 2018
1 parent 1e8fbb1 commit 798feb2
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/librustdoc/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ fn partition_source(s: &str) -> (String, String) {
pub struct Collector {
pub tests: Vec<testing::TestDescAndFn>,
// to be removed when hoedown will be definitely gone
pub old_tests: HashMap<String, Vec<String>>,
pub old_tests: HashMap<FileName, Vec<String>>,

// The name of the test displayed to the user, separated by `::`.
//
Expand Down Expand Up @@ -501,14 +501,8 @@ impl Collector {
format!("{} - {} (line {})", filename, self.names.join("::"), line)
}

// to be removed once hoedown is gone
fn generate_name_beginning(&self, filename: &FileName) -> String {
format!("{} - {} (line", filename, self.names.join("::"))
}

pub fn add_old_test(&mut self, test: String, filename: FileName) {
let name_beg = self.generate_name_beginning(&filename);
let entry = self.old_tests.entry(name_beg)
let entry = self.old_tests.entry(filename.clone())
.or_insert(Vec::new());
entry.push(test.trim().to_owned());
}
Expand All @@ -520,10 +514,9 @@ impl Collector {
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;
let test = test.trim().to_owned();
if let Some(entry) = self.old_tests.get_mut(&name_beg) {
if let Some(entry) = self.old_tests.get_mut(&filename) {
found = entry.remove_item(&test).is_some();
}
if !found {
Expand Down

0 comments on commit 798feb2

Please sign in to comment.