diff --git a/.travis.yml b/.travis.yml index fbd18fd..a5ec6c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,6 @@ matrix: include: - rust: nightly script: - - cargo build - - cargo build --manifest-path tests/deps/Cargo.toml - cargo test - cargo test --features preserve_order - cargo test --features arbitrary_precision diff --git a/Cargo.toml b/Cargo.toml index a839c61..b41cb4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,10 +23,10 @@ ryu = "0.2" [dev-dependencies] automod = "0.1" -compiletest_rs = { version = "0.3", features = ["stable"] } serde_bytes = "0.11" serde_derive = "1.0" serde_stacker = "0.1" +trybuild = "1.0" [package.metadata.docs.rs] features = ["raw_value", "unbounded_depth"] diff --git a/tests/compiletest.rs b/tests/compiletest.rs index 20f1b19..870c2f9 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -1,19 +1,5 @@ -extern crate compiletest_rs as compiletest; - #[test] fn ui() { - compiletest::run_tests(&compiletest::Config { - mode: compiletest::common::Mode::Ui, - src_base: std::path::PathBuf::from("tests/ui"), - target_rustcflags: Some(String::from( - "\ - --edition=2018 \ - -L tests/deps/target/debug/deps \ - -Z unstable-options \ - --extern serde_json \ - ", - )), - build_base: std::path::PathBuf::from("target/ui"), - ..Default::default() - }); + let t = trybuild::TestCases::new(); + t.compile_fail("tests/ui/*.rs"); } diff --git a/tests/deps/Cargo.toml b/tests/deps/Cargo.toml deleted file mode 100644 index bf5f828..0000000 --- a/tests/deps/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "serde_test_suite_deps" -version = "0.0.0" -authors = ["David Tolnay "] -publish = false - -[workspace] - -[features] -arbitrary_precision = ["serde_json/arbitrary_precision"] - -[dependencies] -serde_json = { path = "../.." } diff --git a/tests/deps/src/lib.rs b/tests/deps/src/lib.rs deleted file mode 100644 index e63ee9d..0000000 --- a/tests/deps/src/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(/*=============================================] -#![=== Serde test suite requires a nightly compiler. ===] -#![====================================================*/)] diff --git a/tests/ui/missing_colon.stderr b/tests/ui/missing_colon.stderr index eec0ebd..8b8b5b5 100644 --- a/tests/ui/missing_colon.stderr +++ b/tests/ui/missing_colon.stderr @@ -5,6 +5,3 @@ error: unexpected end of macro invocation | ^^^^^^^^^^^^^^^ missing tokens in macro arguments | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: aborting due to previous error - diff --git a/tests/ui/missing_value.stderr b/tests/ui/missing_value.stderr index fc5a46d..7e223a1 100644 --- a/tests/ui/missing_value.stderr +++ b/tests/ui/missing_value.stderr @@ -5,6 +5,3 @@ error: unexpected end of macro invocation | ^^^^^^^^^^^^^^^^^ missing tokens in macro arguments | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: aborting due to previous error - diff --git a/tests/ui/not_found.stderr b/tests/ui/not_found.stderr index 6b39db1..c62bbe7 100644 --- a/tests/ui/not_found.stderr +++ b/tests/ui/not_found.stderr @@ -4,6 +4,4 @@ error[E0425]: cannot find value `x` in this scope 4 | json!({ "a" : x }); | ^ not found in this scope -error: aborting due to previous error - For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/parse_expr.stderr b/tests/ui/parse_expr.stderr index c182361..2c66d2f 100644 --- a/tests/ui/parse_expr.stderr +++ b/tests/ui/parse_expr.stderr @@ -5,6 +5,3 @@ error: unexpected end of macro invocation | ^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: aborting due to previous error - diff --git a/tests/ui/parse_key.stderr b/tests/ui/parse_key.stderr index c91afcd..7e70b11 100644 --- a/tests/ui/parse_key.stderr +++ b/tests/ui/parse_key.stderr @@ -4,6 +4,4 @@ error[E0609]: no field `s` on type `&'static str` 4 | json!({ "".s : true }); | ^ -error: aborting due to previous error - For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/unexpected_after_array_element.stderr b/tests/ui/unexpected_after_array_element.stderr index 835229b..3708992 100644 --- a/tests/ui/unexpected_after_array_element.stderr +++ b/tests/ui/unexpected_after_array_element.stderr @@ -3,6 +3,3 @@ error: no rules expected the token `=>` | 4 | json!([ true => ]); | ^^ no rules expected this token in macro call - -error: aborting due to previous error - diff --git a/tests/ui/unexpected_after_map_entry.stderr b/tests/ui/unexpected_after_map_entry.stderr index 02484c8..60f9815 100644 --- a/tests/ui/unexpected_after_map_entry.stderr +++ b/tests/ui/unexpected_after_map_entry.stderr @@ -3,6 +3,3 @@ error: no rules expected the token `=>` | 4 | json!({ "k": true => }); | ^^ no rules expected this token in macro call - -error: aborting due to previous error - diff --git a/tests/ui/unexpected_colon.stderr b/tests/ui/unexpected_colon.stderr index 495bbd9..2708b08 100644 --- a/tests/ui/unexpected_colon.stderr +++ b/tests/ui/unexpected_colon.stderr @@ -3,6 +3,3 @@ error: no rules expected the token `:` | 4 | json!({ : true }); | ^ no rules expected this token in macro call - -error: aborting due to previous error - diff --git a/tests/ui/unexpected_comma.stderr b/tests/ui/unexpected_comma.stderr index c6d2b66..65e0453 100644 --- a/tests/ui/unexpected_comma.stderr +++ b/tests/ui/unexpected_comma.stderr @@ -3,6 +3,3 @@ error: no rules expected the token `,` | 4 | json!({ "a" , "b": true }); | ^ no rules expected this token in macro call - -error: aborting due to previous error - diff --git a/tests/ui/update-references.sh b/tests/ui/update-references.sh deleted file mode 100755 index ee500b6..0000000 --- a/tests/ui/update-references.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# A script to update the references for particular tests. The idea is -# that you do a run, which will generate files in the build directory -# containing the (normalized) actual output of the compiler. This -# script will then copy that output and replace the "expected output" -# files. You can then commit the changes. -# -# If you find yourself manually editing a foo.stderr file, you're -# doing it wrong. - -cd "$(dirname "${BASH_SOURCE[0]}")" -BUILD_DIR="../../target/ui" - -for testcase in *.rs; do - STDERR_NAME="${testcase/%.rs/.stderr}" - STDOUT_NAME="${testcase/%.rs/.stdout}" - if [ -f "$BUILD_DIR/$STDOUT_NAME" ] && \ - ! (diff "$BUILD_DIR/$STDOUT_NAME" "$STDOUT_NAME" >& /dev/null); then - echo "updating $STDOUT_NAME" - cp "$BUILD_DIR/$STDOUT_NAME" "$STDOUT_NAME" - fi - if [ -f "$BUILD_DIR/$STDERR_NAME" ] && \ - ! (diff "$BUILD_DIR/$STDERR_NAME" "$STDERR_NAME" >& /dev/null); then - echo "updating $STDERR_NAME" - cp "$BUILD_DIR/$STDERR_NAME" "$STDERR_NAME" - fi -done