mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Remove some more cfg(test)
s
This commit is contained in:
parent
3d0d6ee271
commit
62ec2cb7ac
@ -266,8 +266,10 @@ impl Cache {
|
||||
.expect("invalid type mapped");
|
||||
stepcache.get(step).cloned()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(test)]
|
||||
impl Cache {
|
||||
pub fn all<S: Ord + Copy + Step>(&mut self) -> Vec<(S, S::Output)> {
|
||||
let cache = self.0.get_mut();
|
||||
let type_id = TypeId::of::<S>();
|
||||
@ -279,7 +281,6 @@ impl Cache {
|
||||
v
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn contains<S: Step>(&self) -> bool {
|
||||
self.0.borrow().contains_key(&TypeId::of::<S>())
|
||||
}
|
||||
|
@ -201,7 +201,6 @@ fn test_split_off() {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn fuzz_test(sz: i32) {
|
||||
let mut m: LinkedList<_> = LinkedList::new();
|
||||
let mut v = vec![];
|
||||
|
@ -40,12 +40,10 @@ fn test_basic() {
|
||||
assert_eq!(n.pop_front(), Some(1));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn generate_test() -> LinkedList<i32> {
|
||||
list_from(&[0, 1, 2, 3, 4, 5, 6])
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn list_from<T: Clone>(v: &[T]) -> LinkedList<T> {
|
||||
v.iter().cloned().collect()
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ fn test_simple() {
|
||||
assert_eq!(d[3], 4);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn test_parameterized<T: Clone + PartialEq + Debug>(a: T, b: T, c: T, d: T) {
|
||||
let mut deq = VecDeque::new();
|
||||
assert_eq!(deq.len(), 0);
|
||||
|
@ -127,11 +127,6 @@ impl<Node: Idx> Dominators<Node> {
|
||||
// FIXME -- could be optimized by using post-order-rank
|
||||
self.dominators(node).any(|n| n == dom)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn all_immediate_dominators(&self) -> &IndexVec<Node, Option<Node>> {
|
||||
&self.immediate_dominators
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Iter<'dom, Node: Idx> {
|
||||
|
@ -1,13 +1,13 @@
|
||||
use super::super::tests::TestGraph;
|
||||
|
||||
use super::*;
|
||||
|
||||
use super::super::tests::TestGraph;
|
||||
|
||||
#[test]
|
||||
fn diamond() {
|
||||
let graph = TestGraph::new(0, &[(0, 1), (0, 2), (1, 3), (2, 3)]);
|
||||
|
||||
let dominators = dominators(&graph);
|
||||
let immediate_dominators = dominators.all_immediate_dominators();
|
||||
let immediate_dominators = &dominators.immediate_dominators;
|
||||
assert_eq!(immediate_dominators[0], Some(0));
|
||||
assert_eq!(immediate_dominators[1], Some(0));
|
||||
assert_eq!(immediate_dominators[2], Some(0));
|
||||
@ -22,7 +22,7 @@ fn paper() {
|
||||
(2, 1)]);
|
||||
|
||||
let dominators = dominators(&graph);
|
||||
let immediate_dominators = dominators.all_immediate_dominators();
|
||||
let immediate_dominators = &dominators.immediate_dominators;
|
||||
assert_eq!(immediate_dominators[0], None); // <-- note that 0 is not in graph
|
||||
assert_eq!(immediate_dominators[1], Some(6));
|
||||
assert_eq!(immediate_dominators[2], Some(6));
|
||||
|
@ -1,6 +1,4 @@
|
||||
#![cfg(test)]
|
||||
|
||||
use super::{Error, DoCompleted, ObligationForest, ObligationProcessor, Outcome, ProcessResult};
|
||||
use super::*;
|
||||
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
|
@ -384,21 +384,6 @@ pub fn vis_to_string(v: &ast::Visibility) -> String {
|
||||
to_string(|s| s.print_visibility(v))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn fun_to_string(decl: &ast::FnDecl,
|
||||
header: ast::FnHeader,
|
||||
name: ast::Ident,
|
||||
generics: &ast::Generics)
|
||||
-> String {
|
||||
to_string(|s| {
|
||||
s.head("");
|
||||
s.print_fn(decl, header, Some(name),
|
||||
generics, &source_map::dummy_spanned(ast::VisibilityKind::Inherited));
|
||||
s.end(); // Close the head box
|
||||
s.end(); // Close the outer box
|
||||
})
|
||||
}
|
||||
|
||||
fn block_to_string(blk: &ast::Block) -> String {
|
||||
to_string(|s| {
|
||||
// containing cbox, will be closed by print-block at }
|
||||
@ -421,11 +406,6 @@ pub fn attribute_to_string(attr: &ast::Attribute) -> String {
|
||||
to_string(|s| s.print_attribute(attr))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn variant_to_string(var: &ast::Variant) -> String {
|
||||
to_string(|s| s.print_variant(var))
|
||||
}
|
||||
|
||||
pub fn arg_to_string(arg: &ast::Arg) -> String {
|
||||
to_string(|s| s.print_arg(arg, false))
|
||||
}
|
||||
|
@ -5,6 +5,22 @@ use crate::source_map;
|
||||
use crate::with_default_globals;
|
||||
use syntax_pos;
|
||||
|
||||
fn fun_to_string(
|
||||
decl: &ast::FnDecl, header: ast::FnHeader, name: ast::Ident, generics: &ast::Generics
|
||||
) -> String {
|
||||
to_string(|s| {
|
||||
s.head("");
|
||||
s.print_fn(decl, header, Some(name),
|
||||
generics, &source_map::dummy_spanned(ast::VisibilityKind::Inherited));
|
||||
s.end(); // Close the head box
|
||||
s.end(); // Close the outer box
|
||||
})
|
||||
}
|
||||
|
||||
fn variant_to_string(var: &ast::Variant) -> String {
|
||||
to_string(|s| s.print_variant(var))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fun_to_string() {
|
||||
with_default_globals(|| {
|
||||
|
@ -380,28 +380,6 @@ pub struct TestOpts {
|
||||
pub options: Options,
|
||||
}
|
||||
|
||||
impl TestOpts {
|
||||
#[cfg(test)]
|
||||
fn new() -> TestOpts {
|
||||
TestOpts {
|
||||
list: false,
|
||||
filter: None,
|
||||
filter_exact: false,
|
||||
exclude_should_panic: false,
|
||||
run_ignored: RunIgnored::No,
|
||||
run_tests: false,
|
||||
bench_benchmarks: false,
|
||||
logfile: None,
|
||||
nocapture: false,
|
||||
color: AutoColor,
|
||||
format: OutputFormat::Pretty,
|
||||
test_threads: None,
|
||||
skip: vec![],
|
||||
options: Options::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Result of parsing the options.
|
||||
pub type OptRes = Result<TestOpts, String>;
|
||||
|
||||
|
@ -7,6 +7,27 @@ use crate::test::{
|
||||
};
|
||||
use std::sync::mpsc::channel;
|
||||
|
||||
impl TestOpts {
|
||||
fn new() -> TestOpts {
|
||||
TestOpts {
|
||||
list: false,
|
||||
filter: None,
|
||||
filter_exact: false,
|
||||
exclude_should_panic: false,
|
||||
run_ignored: RunIgnored::No,
|
||||
run_tests: false,
|
||||
bench_benchmarks: false,
|
||||
logfile: None,
|
||||
nocapture: false,
|
||||
color: AutoColor,
|
||||
format: OutputFormat::Pretty,
|
||||
test_threads: None,
|
||||
skip: vec![],
|
||||
options: Options::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
|
||||
vec![
|
||||
TestDescAndFn {
|
||||
|
Loading…
Reference in New Issue
Block a user