serde/test_suite/tests/compiletest.rs

37 lines
947 B
Rust
Raw Normal View History

2017-04-13 19:34:42 -05:00
// Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
2017-03-08 23:02:15 -06:00
#![cfg(feature = "unstable")]
extern crate compiletest_rs as compiletest;
2017-01-27 16:37:28 -06:00
use std::env;
fn run_mode(mode: &'static str) {
let mut config = compiletest::Config::default();
2017-01-27 16:37:28 -06:00
config.mode = mode.parse().expect("invalid mode");
2017-01-27 16:53:21 -06:00
config.target_rustcflags = Some("-L deps/target/debug/deps".to_owned());
2017-01-27 16:37:28 -06:00
if let Ok(name) = env::var("TESTNAME") {
config.filter = Some(name);
}
2017-01-27 16:37:28 -06:00
config.src_base = format!("tests/{}", mode).into();
compiletest::run_tests(&config);
}
#[test]
2016-07-04 16:49:50 -05:00
fn compile_fail() {
run_mode("compile-fail");
}
2016-07-04 16:49:50 -05:00
#[test]
fn run_pass() {
run_mode("run-pass");
}