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")]
|
2017-02-24 17:32:13 -06:00
|
|
|
|
2016-01-18 14:39:46 -06:00
|
|
|
extern crate compiletest_rs as compiletest;
|
|
|
|
|
2017-01-27 16:37:28 -06:00
|
|
|
use std::env;
|
2016-01-18 14:39:46 -06:00
|
|
|
|
|
|
|
fn run_mode(mode: &'static str) {
|
2017-08-16 00:10:18 -05:00
|
|
|
let mut config = compiletest::Config::default();
|
2016-01-18 14:39:46 -06:00
|
|
|
|
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);
|
2016-01-18 14:39:46 -06:00
|
|
|
}
|
2017-01-27 16:37:28 -06:00
|
|
|
config.src_base = format!("tests/{}", mode).into();
|
2016-01-18 14:39:46 -06:00
|
|
|
|
|
|
|
compiletest::run_tests(&config);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2016-07-04 16:49:50 -05:00
|
|
|
fn compile_fail() {
|
2016-01-18 14:39:46 -06:00
|
|
|
run_mode("compile-fail");
|
|
|
|
}
|
2016-07-04 16:49:50 -05:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn run_pass() {
|
|
|
|
run_mode("run-pass");
|
|
|
|
}
|