Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Apr 1, 2019
1 parent 591e503 commit 9ebc97a
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,15 @@ pub struct ExternEntry {
pub public: bool
}

impl ExternEntry {
pub fn new_public(location: Option<String>) -> ExternEntry {
ExternEntry {
location,
public: true
}
}
}

impl Externs {
pub fn new(data: BTreeMap<String, BTreeSet<ExternEntry>>) -> Externs {
Externs(data)
Expand Down Expand Up @@ -2677,7 +2686,7 @@ mod tests {
build_session_options_and_crate_config,
to_crate_config
};
use crate::session::config::{LtoCli, LinkerPluginLto};
use crate::session::config::{LtoCli, LinkerPluginLto, ExternEntry};
use crate::session::build_session;
use crate::session::search_paths::SearchPath;
use std::collections::{BTreeMap, BTreeSet};
Expand Down Expand Up @@ -2823,33 +2832,45 @@ mod tests {
v1.externs = Externs::new(mk_map(vec![
(
String::from("a"),
mk_set(vec![Some(String::from("b")), Some(String::from("c"))]),
mk_set(vec![ExternEntry::new_public(Some(String::from("b"))),
ExternEntry::new_public(Some(String::from("c")))
]),
),
(
String::from("d"),
mk_set(vec![Some(String::from("e")), Some(String::from("f"))]),
mk_set(vec![ExternEntry::new_public(Some(String::from("e"))),
ExternEntry::new_public(Some(String::from("f")))
]),
),
]));

v2.externs = Externs::new(mk_map(vec![
(
String::from("d"),
mk_set(vec![Some(String::from("e")), Some(String::from("f"))]),
mk_set(vec![ExternEntry::new_public(Some(String::from("e"))),
ExternEntry::new_public(Some(String::from("f")))
]),
),
(
String::from("a"),
mk_set(vec![Some(String::from("b")), Some(String::from("c"))]),
mk_set(vec![ExternEntry::new_public(Some(String::from("b"))),
ExternEntry::new_public(Some(String::from("c")))
]),
),
]));

v3.externs = Externs::new(mk_map(vec![
(
String::from("a"),
mk_set(vec![Some(String::from("b")), Some(String::from("c"))]),
mk_set(vec![ExternEntry::new_public(Some(String::from("b"))),
ExternEntry::new_public(Some(String::from("c")))
]),
),
(
String::from("d"),
mk_set(vec![Some(String::from("f")), Some(String::from("e"))]),
mk_set(vec![ExternEntry::new_public(Some(String::from("f"))),
ExternEntry::new_public(Some(String::from("e")))
]),
),
]));

Expand Down

0 comments on commit 9ebc97a

Please sign in to comment.