Reorganise the testsuite crate module hierarchy

* Collapse the nested cargotest::support module into the cargotest
  module (merge the mod.rs's)
* Rename the cargotest module to support
* Nest the top-level hamcrest module into support
This commit is contained in:
Dale Wijnand 2018-07-21 22:17:44 +01:00
parent ffcf739578
commit 43b42d6f4c
No known key found for this signature in database
GPG key ID: 4F256E3D151DF5EF
84 changed files with 476 additions and 485 deletions

View file

@ -1,7 +1,7 @@
use cargotest::ChannelChanger;
use cargotest::support::registry::{self, alt_api_path, Package};
use cargotest::support::{execs, paths, project};
use hamcrest::assert_that;
use support::ChannelChanger;
use support::registry::{self, alt_api_path, Package};
use support::{execs, paths, project};
use support::hamcrest::assert_that;
use std::fs::File;
use std::io::Write;

View file

@ -1,6 +1,6 @@
use cargotest::support::{execs, project};
use cargotest::support::registry::Package;
use hamcrest::assert_that;
use support::{execs, project};
use support::registry::Package;
use support::hamcrest::assert_that;
#[test]
fn bad1() {

View file

@ -1,5 +1,5 @@
use cargotest::support::{basic_bin_manifest, execs, main_file, project};
use hamcrest::assert_that;
use support::{basic_bin_manifest, execs, main_file, project};
use support::hamcrest::assert_that;
fn assert_not_a_cargo_toml(command: &str, manifest_path_argument: &str) {
let p = project()

View file

@ -1,10 +1,10 @@
use std::str;
use cargo::util::process;
use cargotest::{is_nightly, ChannelChanger};
use cargotest::support::paths::CargoPathExt;
use cargotest::support::{basic_bin_manifest, basic_lib_manifest, execs, project};
use hamcrest::{assert_that, existing_file};
use support::{is_nightly, ChannelChanger};
use support::paths::CargoPathExt;
use support::{basic_bin_manifest, basic_lib_manifest, execs, project};
use support::hamcrest::{assert_that, existing_file};
#[test]
fn cargo_bench_simple() {

View file

@ -4,13 +4,13 @@ use std::io::prelude::*;
use cargo::util::paths::dylib_path_envvar;
use cargo::util::{process, ProcessBuilder};
use cargotest::{is_nightly, rustc_host, sleep_ms};
use cargotest::support::paths::{root, CargoPathExt};
use cargotest::support::ProjectBuilder;
use cargotest::support::{basic_bin_manifest, execs, main_file, project};
use cargotest::support::registry::Package;
use cargotest::ChannelChanger;
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
use support::{is_nightly, rustc_host, sleep_ms};
use support::paths::{root, CargoPathExt};
use support::ProjectBuilder;
use support::{basic_bin_manifest, execs, main_file, project};
use support::registry::Package;
use support::ChannelChanger;
use support::hamcrest::{assert_that, existing_dir, existing_file, is_not};
use tempfile;
#[test]

View file

@ -6,9 +6,9 @@ use std::thread;
use git2;
use bufstream::BufStream;
use cargotest::support::paths;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::paths;
use support::{execs, project};
use support::hamcrest::assert_that;
// Test that HTTP auth is offered from `credential.helper`
#[test]

View file

@ -1,5 +1,5 @@
use cargotest::support::{basic_bin_manifest, execs, project, Project};
use hamcrest::assert_that;
use support::{basic_bin_manifest, execs, project, Project};
use support::hamcrest::assert_that;
fn verbose_output_for_lib(p: &Project) -> String {
format!(

View file

@ -1,6 +1,6 @@
use cargotest::ChannelChanger;
use cargotest::support::{basic_bin_manifest, execs, main_file, project};
use hamcrest::{assert_that, existing_file, is_not};
use support::ChannelChanger;
use support::{basic_bin_manifest, execs, main_file, project};
use support::hamcrest::{assert_that, existing_file, is_not};
#[test]
fn cargo_build_plan_simple() {

View file

@ -7,11 +7,11 @@ use std::thread;
use std::time::Duration;
use cargo::util::paths::remove_dir_all;
use cargotest::{rustc_host, sleep_ms};
use cargotest::support::{cross_compile, execs, project};
use cargotest::support::paths::CargoPathExt;
use cargotest::support::registry::Package;
use hamcrest::{assert_that, existing_dir, existing_file};
use support::{rustc_host, sleep_ms};
use support::{cross_compile, execs, project};
use support::paths::CargoPathExt;
use support::registry::Package;
use support::hamcrest::{assert_that, existing_dir, existing_file};
#[test]
fn custom_build_script_failed() {

View file

@ -1,8 +1,8 @@
use std::fs::File;
use cargotest::sleep_ms;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::sleep_ms;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn rerun_if_env_changes() {

View file

@ -1,5 +1,5 @@
use cargotest::support::{basic_bin_manifest, execs, project};
use hamcrest::assert_that;
use support::{basic_bin_manifest, execs, project};
use support::hamcrest::assert_that;
#[test]
fn alias_incorrect_config_type() {

View file

@ -5,11 +5,11 @@ use std::path::{Path, PathBuf};
use std::str;
use cargo;
use cargotest::cargo_process;
use cargotest::support::paths::{self, CargoPathExt};
use cargotest::support::registry::Package;
use cargotest::support::{basic_bin_manifest, cargo_exe, execs, project, Project};
use hamcrest::{assert_that, existing_file};
use support::cargo_process;
use support::paths::{self, CargoPathExt};
use support::registry::Package;
use support::{basic_bin_manifest, cargo_exe, execs, project, Project};
use support::hamcrest::{assert_that, existing_file};
#[cfg_attr(windows, allow(dead_code))]
enum FakeKind<'a> {

View file

@ -1,6 +1,6 @@
use cargotest::ChannelChanger;
use cargotest::support::{execs, project, publish};
use hamcrest::assert_that;
use support::ChannelChanger;
use support::{execs, project, publish};
use support::hamcrest::assert_that;
#[test]
fn feature_required() {

View file

@ -1,179 +0,0 @@
/*
# Introduction To `cargotest`
Cargo has a wide variety of integration tests that execute the `cargo` binary
and verify its behavior. The `cargotest` module contains many helpers to make
this process easy.
The general form of a test involves creating a "project", running cargo, and
checking the result. Projects are created with the `ProjectBuilder` where you
specify some files to create. The general form looks like this:
```
let p = project()
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/main.rs", r#"fn main() { println!("hi!"); }"#)
.build();
```
To run cargo, call the `cargo` method and use the `hamcrest` matchers to check
the output.
```
assert_that(
p.cargo("run --bin foo"),
execs()
.with_status(0)
.with_stderr(
"\
[COMPILING] foo [..]
[FINISHED] [..]
[RUNNING] `target[/]debug[/]foo`
",
)
.with_stdout("hi!"),
);
```
The project creates a mini sandbox under the "cargo integration test"
directory with each test getting a separate directory such as
`/path/to/cargo/target/cit/t123/`. Each project appears as a separate
directory. There is also an empty `home` directory created that will be used
as a home directory instead of your normal home directory.
See `cargotest::support::lines_match` for an explanation of the string pattern
matching.
See the `hamcrest` module for other matchers like
`is_not(existing_file(path))`. This is not the actual hamcrest library, but
instead a lightweight subset of matchers that are used in cargo tests.
Browse the `pub` functions in the `cargotest` module for a variety of other
helpful utilities.
## Testing Nightly Features
If you are testing a Cargo feature that only works on "nightly" cargo, then
you need to call `masquerade_as_nightly_cargo` on the process builder like
this:
```
p.cargo("build").masquerade_as_nightly_cargo()
```
If you are testing a feature that only works on *nightly rustc* (such as
benchmarks), then you should exit the test if it is not running with nightly
rust, like this:
```
if !is_nightly() {
return;
}
```
## Platform-specific Notes
When checking output, be sure to use `[/]` when checking paths to
automatically support backslashes on Windows.
Be careful when executing binaries on Windows. You should not rename, delete,
or overwrite a binary immediately after running it. Under some conditions
Windows will fail with errors like "directory not empty" or "failed to remove"
or "access is denied".
*/
use std::ffi::OsStr;
use std::time::Duration;
use cargo::util::Rustc;
use cargo;
use std::path::{Path, PathBuf};
#[macro_use]
pub mod support;
pub mod install;
thread_local!(
pub static RUSTC: Rustc = Rustc::new(
PathBuf::from("rustc"),
None,
Path::new("should be path to rustup rustc, but we don't care in tests"),
None,
).unwrap()
);
/// The rustc host such as `x86_64-unknown-linux-gnu`.
pub fn rustc_host() -> String {
RUSTC.with(|r| r.host.clone())
}
pub fn is_nightly() -> bool {
RUSTC.with(|r| r.verbose_version.contains("-nightly") || r.verbose_version.contains("-dev"))
}
pub fn process<T: AsRef<OsStr>>(t: T) -> cargo::util::ProcessBuilder {
_process(t.as_ref())
}
fn _process(t: &OsStr) -> cargo::util::ProcessBuilder {
let mut p = cargo::util::process(t);
p.cwd(&support::paths::root())
.env_remove("CARGO_HOME")
.env("HOME", support::paths::home())
.env("CARGO_HOME", support::paths::home().join(".cargo"))
.env("__CARGO_TEST_ROOT", support::paths::root())
// Force cargo to think it's on the stable channel for all tests, this
// should hopefully not surprise us as we add cargo features over time and
// cargo rides the trains.
.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "stable")
// For now disable incremental by default as support hasn't ridden to the
// stable channel yet. Once incremental support hits the stable compiler we
// can switch this to one and then fix the tests.
.env("CARGO_INCREMENTAL", "0")
// This env var can switch the git backend from libgit2 to git2-curl, which
// can tweak error messages and cause some tests to fail, so let's forcibly
// remove it.
.env_remove("CARGO_HTTP_CHECK_REVOKE")
.env_remove("__CARGO_DEFAULT_LIB_METADATA")
.env_remove("RUSTC")
.env_remove("RUSTDOC")
.env_remove("RUSTC_WRAPPER")
.env_remove("RUSTFLAGS")
.env_remove("XDG_CONFIG_HOME") // see #2345
.env("GIT_CONFIG_NOSYSTEM", "1") // keep trying to sandbox ourselves
.env_remove("EMAIL")
.env_remove("MFLAGS")
.env_remove("MAKEFLAGS")
.env_remove("CARGO_MAKEFLAGS")
.env_remove("GIT_AUTHOR_NAME")
.env_remove("GIT_AUTHOR_EMAIL")
.env_remove("GIT_COMMITTER_NAME")
.env_remove("GIT_COMMITTER_EMAIL")
.env_remove("CARGO_TARGET_DIR") // we assume 'target'
.env_remove("MSYSTEM"); // assume cmd.exe everywhere on windows
return p;
}
pub trait ChannelChanger: Sized {
fn masquerade_as_nightly_cargo(&mut self) -> &mut Self;
}
impl ChannelChanger for cargo::util::ProcessBuilder {
fn masquerade_as_nightly_cargo(&mut self) -> &mut Self {
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
}
}
pub fn cargo_process() -> cargo::util::ProcessBuilder {
process(&support::cargo_exe())
}
pub fn sleep_ms(ms: u64) {
::std::thread::sleep(Duration::from_millis(ms));
}

View file

@ -2,10 +2,10 @@ use std::str::FromStr;
use std::fmt;
use cargo::util::{Cfg, CfgExpr};
use cargotest::rustc_host;
use cargotest::support::registry::Package;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::rustc_host;
use support::registry::Package;
use support::{execs, project};
use support::hamcrest::assert_that;
macro_rules! c {
($a:ident) => (

View file

@ -1,10 +1,10 @@
use cargotest::install::exe;
use cargotest::is_nightly;
use cargotest::support::paths::CargoPathExt;
use cargotest::support::registry::Package;
use cargotest::support::{execs, project};
use support::install::exe;
use support::is_nightly;
use support::paths::CargoPathExt;
use support::registry::Package;
use support::{execs, project};
use glob::glob;
use hamcrest::{assert_that, existing_file, is_not};
use support::hamcrest::{assert_that, existing_file, is_not};
const SIMPLE_MANIFEST: &str = r#"
[package]

View file

@ -1,8 +1,8 @@
use std::env;
use cargotest::support::{basic_bin_manifest, execs, git, main_file, project};
use cargotest::support::registry::Package;
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
use support::{basic_bin_manifest, execs, git, main_file, project};
use support::registry::Package;
use support::hamcrest::{assert_that, existing_dir, existing_file, is_not};
#[test]
fn cargo_clean_simple() {

View file

@ -8,12 +8,12 @@ use std::sync::mpsc::channel;
use std::time::Duration;
use git2;
use cargotest;
use cargotest::install::{cargo_home, has_installed_exe};
use cargotest::support::git;
use cargotest::support::registry::Package;
use cargotest::support::{execs, project};
use hamcrest::{assert_that, existing_file};
use support;
use support::install::{cargo_home, has_installed_exe};
use support::git;
use support::registry::Package;
use support::{execs, project};
use support::hamcrest::{assert_that, existing_file};
fn pkg(name: &str, vers: &str) {
Package::new(name, vers)
@ -72,11 +72,11 @@ fn concurrent_installs() {
pkg("foo", "0.0.1");
pkg("bar", "0.0.1");
let mut a = cargotest::cargo_process()
let mut a = support::cargo_process()
.arg("install")
.arg("foo")
.build_command();
let mut b = cargotest::cargo_process()
let mut b = support::cargo_process()
.arg("install")
.arg("bar")
.build_command();

View file

@ -2,8 +2,8 @@ use cargo::core::{Shell, enable_nightly_features};
use cargo::util::config::{self, Config};
use cargo::util::toml::{self, VecStringOrBool as VSOB};
use cargo::CargoError;
use cargotest::support::{execs, lines_match, paths, project};
use hamcrest::assert_that;
use support::{execs, lines_match, paths, project};
use support::hamcrest::assert_that;
use std::collections;
use std::fs;

View file

@ -2,9 +2,9 @@ use std::fs;
use std::path::{Path, PathBuf};
use cargo::util::paths as cargopaths;
use cargotest::support::paths;
use cargotest::support::{execs, git, project};
use hamcrest::assert_that;
use support::paths;
use support::{execs, git, project};
use support::hamcrest::assert_that;
#[test]
fn deleting_database_files() {

View file

@ -1,7 +1,7 @@
use cargo::util::process;
use cargotest::{is_nightly, rustc_host};
use cargotest::support::{basic_bin_manifest, cross_compile, execs, project};
use hamcrest::{assert_that, existing_file};
use support::{is_nightly, rustc_host};
use support::{basic_bin_manifest, cross_compile, execs, project};
use support::hamcrest::{assert_that, existing_file};
#[test]
fn simple_cross() {

View file

@ -2,8 +2,8 @@ use std::fs::File;
use std::path::PathBuf;
use std::io::prelude::*;
use cargotest::support::{cross_compile, execs, project, publish};
use hamcrest::{assert_that, contains};
use support::{cross_compile, execs, project, publish};
use support::hamcrest::{assert_that, contains};
use flate2::read::GzDecoder;
use tar::Archive;

View file

@ -1,6 +1,6 @@
use cargotest::is_nightly;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::is_nightly;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn custom_target_minimal() {

View file

@ -5,7 +5,7 @@ use std::process::{Child, Stdio};
use std::thread;
use std::time::Duration;
use cargotest::support::project;
use support::project;
#[cfg(unix)]
fn enabled() -> bool {

View file

@ -1,6 +1,6 @@
use cargotest::support::{basic_bin_manifest, execs, main_file, project};
use support::{basic_bin_manifest, execs, main_file, project};
use filetime::FileTime;
use hamcrest::{assert_that, existing_file};
use support::hamcrest::{assert_that, existing_file};
#[test]
fn build_dep_info() {

View file

@ -4,12 +4,12 @@ use std::fs::{self, File};
use std::io::prelude::*;
use std::str;
use cargotest::cargo_process;
use cargotest::support::git;
use cargotest::support::paths;
use cargotest::support::registry::{cksum, Package};
use cargotest::support::{execs, project, ProjectBuilder};
use hamcrest::assert_that;
use support::cargo_process;
use support::git;
use support::paths;
use support::registry::{cksum, Package};
use support::{execs, project, ProjectBuilder};
use support::hamcrest::assert_that;
fn setup() {
let root = paths::root();

View file

@ -1,13 +1,13 @@
use cargotest;
use support;
use std::str;
use std::fs::{self, File};
use std::io::Read;
use cargotest::{is_nightly, rustc_host, ChannelChanger};
use cargotest::support::{basic_lib_manifest, execs, git, project, path2url};
use cargotest::support::paths::CargoPathExt;
use cargotest::support::registry::Package;
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
use support::{is_nightly, rustc_host, ChannelChanger};
use support::{basic_lib_manifest, execs, git, project, path2url};
use support::paths::CargoPathExt;
use support::registry::Package;
use support::hamcrest::{assert_that, existing_dir, existing_file, is_not};
use cargo::util::ProcessError;
use glob::glob;
@ -1216,7 +1216,7 @@ fn document_only_lib() {
#[test]
fn plugins_no_use_target() {
if !cargotest::is_nightly() {
if !support::is_nightly() {
return;
}
let p = project()
@ -1591,7 +1591,7 @@ fn doc_workspace_open_binary_and_library() {
#[test]
fn doc_edition() {
if !cargotest::is_nightly() {
if !support::is_nightly() {
// Stable rustdoc won't have the edition option. Remove this once it
// is stabilized.
return;

View file

@ -1,11 +1,11 @@
use std::fs::File;
use std::io::prelude::*;
use cargotest::support::paths::CargoPathExt;
use cargotest::support::{execs, project};
use cargotest::ChannelChanger;
use hamcrest::assert_that;
use cargotest::support::registry::Package;
use support::paths::CargoPathExt;
use support::{execs, project};
use support::ChannelChanger;
use support::hamcrest::assert_that;
use support::registry::Package;
#[test]
fn invalid1() {

View file

@ -1,7 +1,7 @@
use cargotest::rustc_host;
use cargotest::support::registry::Package;
use cargotest::support::{cross_compile, execs, project};
use hamcrest::assert_that;
use support::rustc_host;
use support::registry::Package;
use support::{cross_compile, execs, project};
use support::hamcrest::assert_that;
#[test]
fn no_deps() {

View file

@ -1,8 +1,8 @@
use cargotest::support::git;
use cargotest::support::{execs, project};
use cargotest::{is_nightly, ChannelChanger};
use support::git;
use support::{execs, project};
use support::{is_nightly, ChannelChanger};
use git2;
use hamcrest::assert_that;
use support::hamcrest::assert_that;
#[test]
fn do_not_fix_broken_builds() {

View file

@ -1,11 +1,11 @@
use std::fs::{self, File};
use std::io::prelude::*;
use cargotest::sleep_ms;
use cargotest::support::paths::CargoPathExt;
use cargotest::support::registry::Package;
use cargotest::support::{execs, path2url, project};
use hamcrest::{assert_that, existing_file};
use support::sleep_ms;
use support::paths::CargoPathExt;
use support::registry::Package;
use support::{execs, path2url, project};
use support::hamcrest::{assert_that, existing_file};
#[test]
fn modifying_and_moving() {

View file

@ -1,10 +1,10 @@
use std::fs::{self, File};
use std::io::prelude::*;
use cargotest::support::registry::Package;
use cargotest::support::{execs, paths, project, ProjectBuilder};
use cargotest::ChannelChanger;
use hamcrest::{assert_that, existing_file, is_not};
use support::registry::Package;
use support::{execs, paths, project, ProjectBuilder};
use support::ChannelChanger;
use support::hamcrest::{assert_that, existing_file, is_not};
#[test]
fn adding_and_removing_packages() {

View file

@ -8,11 +8,11 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::thread;
use cargo::util::process;
use cargotest::sleep_ms;
use cargotest::support::paths::{self, CargoPathExt};
use cargotest::support::{execs, git, main_file, project, path2url};
use cargotest::ChannelChanger;
use hamcrest::{assert_that, existing_file};
use support::sleep_ms;
use support::paths::{self, CargoPathExt};
use support::{execs, git, main_file, project, path2url};
use support::ChannelChanger;
use support::hamcrest::{assert_that, existing_file};
#[test]
fn cargo_compile_simple_git_dep() {

View file

@ -1,15 +1,15 @@
use cargotest;
use support;
use std::fs::{self, File};
use std::io::prelude::*;
use std::env;
use cargo::util::ProcessBuilder;
use cargotest::support::{cargo_exe, execs, paths};
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
use support::{cargo_exe, execs, paths};
use support::hamcrest::{assert_that, existing_dir, existing_file, is_not};
use tempfile;
fn cargo_process(s: &str) -> ProcessBuilder {
let mut p = cargotest::process(&cargo_exe());
let mut p = support::process(&cargo_exe());
p.arg(s).cwd(&paths::root()).env("HOME", &paths::home());
p
}

View file

@ -1,20 +1,20 @@
use cargotest;
use support;
use std::fs::{self, File, OpenOptions};
use std::io::prelude::*;
use cargo::util::ProcessBuilder;
use cargotest::install::{cargo_home, has_installed_exe};
use cargotest::support::cross_compile;
use cargotest::support::git;
use cargotest::support::paths;
use cargotest::support::registry::Package;
use cargotest::support::{execs, project};
use cargotest::ChannelChanger;
use support::install::{cargo_home, has_installed_exe};
use support::cross_compile;
use support::git;
use support::paths;
use support::registry::Package;
use support::{execs, project};
use support::ChannelChanger;
use git2;
use hamcrest::{assert_that, existing_dir, is_not};
use support::hamcrest::{assert_that, existing_dir, is_not};
fn cargo_process(s: &str) -> ProcessBuilder {
let mut p = cargotest::cargo_process();
let mut p = support::cargo_process();
p.arg(s);
p
}
@ -1050,7 +1050,7 @@ warning: To build the current package use `cargo build`, to install the current
#[test]
fn installs_from_cwd_with_2018_warnings() {
if !cargotest::is_nightly() {
if !support::is_nightly() {
// Stable rust won't have the edition option. Remove this once it
// is stabilized.
return;
@ -1343,7 +1343,7 @@ fn install_target_native() {
cargo_process("install")
.arg("foo")
.arg("--target")
.arg(cargotest::rustc_host()),
.arg(support::rustc_host()),
execs()
.with_status(0),
);

View file

@ -2,8 +2,8 @@ use std::net::TcpListener;
use std::thread;
use std::process::Command;
use cargotest::support::{cargo_exe, execs, project};
use hamcrest::assert_that;
use support::{cargo_exe, execs, project};
use support::hamcrest::assert_that;
#[test]
fn jobserver_exists() {

View file

@ -1,10 +1,10 @@
use std::fs::{self, File};
use std::io::prelude::*;
use cargotest::support::paths::{self, CargoPathExt};
use cargotest::support::registry::Package;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::paths::{self, CargoPathExt};
use support::registry::Package;
use support::{execs, project};
use support::hamcrest::assert_that;
fn setup() {
let root = paths::root();

View file

@ -1,7 +1,7 @@
use cargotest::support::git;
use cargotest::support::registry::Package;
use cargotest::support::{execs, lines_match, project};
use hamcrest::assert_that;
use support::git;
use support::registry::Package;
use support::{execs, lines_match, project};
use support::hamcrest::assert_that;
#[test]
fn oldest_lockfile_still_works() {

View file

@ -2,13 +2,13 @@ use std::io::prelude::*;
use std::fs::{self, File};
use toml;
use cargotest::{cargo_process, ChannelChanger};
use cargotest::support::execs;
use cargotest::support::registry::registry;
use cargotest::install::cargo_home;
use support::{cargo_process, ChannelChanger};
use support::execs;
use support::registry::registry;
use support::install::cargo_home;
use cargo::util::config::Config;
use cargo::core::Shell;
use hamcrest::{assert_that, existing_file, is_not};
use support::hamcrest::{assert_that, existing_file, is_not};
const TOKEN: &str = "test-token";
const ORIGINAL_TOKEN: &str = "api-token";

View file

@ -20,8 +20,7 @@ extern crate url;
extern crate winapi;
#[macro_use]
mod cargotest;
mod hamcrest;
mod support;
mod alt_registry;
mod bad_config;

View file

@ -1,6 +1,6 @@
use cargotest::support::registry::Package;
use cargotest::support::{basic_bin_manifest, basic_lib_manifest, execs, main_file, project};
use hamcrest::assert_that;
use support::registry::Package;
use support::{basic_bin_manifest, basic_lib_manifest, execs, main_file, project};
use support::hamcrest::assert_that;
#[test]
fn cargo_metadata_simple() {

View file

@ -1,5 +1,5 @@
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn net_retry_loads_from_config() {

View file

@ -2,15 +2,15 @@ use std::fs::{self, File};
use std::io::prelude::*;
use std::env;
use cargotest;
use support;
use cargo::util::ProcessBuilder;
use cargotest::process;
use cargotest::support::{execs, paths};
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
use support::process;
use support::{execs, paths};
use support::hamcrest::{assert_that, existing_dir, existing_file, is_not};
use tempfile;
fn cargo_process(s: &str) -> ProcessBuilder {
let mut p = cargotest::cargo_process();
let mut p = support::cargo_process();
p.arg(s);
p
}

View file

@ -2,10 +2,10 @@ use std::path::Path;
use std::fs::{self, File};
use std::env;
use hamcrest::assert_that;
use support::hamcrest::assert_that;
use cargotest::{process, sleep_ms, ChannelChanger};
use cargotest::support::{execs, project};
use support::{process, sleep_ms, ChannelChanger};
use support::{execs, project};
#[test]
fn binary_with_debug() {

View file

@ -1,8 +1,8 @@
use cargotest::support::git;
use cargotest::support::paths;
use cargotest::support::registry::Package;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::git;
use support::paths;
use support::registry::Package;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn override_simple() {

View file

@ -4,11 +4,11 @@ use std::io::prelude::*;
use std::path::{Path, PathBuf};
use git2;
use cargotest::{cargo_process, process, sleep_ms, ChannelChanger};
use cargotest::support::{cargo_exe, execs, git, paths, project, registry, path2url};
use cargotest::support::registry::Package;
use support::{cargo_process, process, sleep_ms, ChannelChanger};
use support::{cargo_exe, execs, git, paths, project, registry, path2url};
use support::registry::Package;
use flate2::read::GzDecoder;
use hamcrest::{assert_that, contains, existing_file};
use support::hamcrest::{assert_that, contains, existing_file};
use tar::Archive;
#[test]

View file

@ -2,11 +2,11 @@ use std::fs::{self, File};
use std::io::{Read, Write};
use toml;
use cargotest::support::git;
use cargotest::support::paths;
use cargotest::support::registry::Package;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::git;
use support::paths;
use support::registry::Package;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn replace() {

View file

@ -2,11 +2,11 @@ use std::fs::{self, File};
use std::io::prelude::*;
use cargo::util::process;
use cargotest::sleep_ms;
use cargotest::support::paths::{self, CargoPathExt};
use cargotest::support::registry::Package;
use cargotest::support::{execs, main_file, project};
use hamcrest::{assert_that, existing_file, is_not};
use support::sleep_ms;
use support::paths::{self, CargoPathExt};
use support::registry::Package;
use support::{execs, main_file, project};
use support::hamcrest::{assert_that, existing_file, is_not};
#[test]
#[cfg(not(windows))] // I have no idea why this is failing spuriously on

View file

@ -1,9 +1,9 @@
use std::fs;
use std::env;
use cargotest::{is_nightly, rustc_host};
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::{is_nightly, rustc_host};
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn plugin_to_the_max() {

View file

@ -1,6 +1,6 @@
use cargotest::is_nightly;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::is_nightly;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn probe_cfg_before_crate_type_discovery() {

View file

@ -1,6 +1,6 @@
use cargotest::support::{basic_lib_manifest, execs, paths, project};
use cargotest::ChannelChanger;
use hamcrest::assert_that;
use support::{basic_lib_manifest, execs, paths, project};
use support::ChannelChanger;
use support::hamcrest::assert_that;
#[test]
fn profile_config_gated() {

View file

@ -1,6 +1,6 @@
use cargotest::support::{basic_lib_manifest, execs, project};
use cargotest::ChannelChanger;
use hamcrest::assert_that;
use support::{basic_lib_manifest, execs, project};
use support::ChannelChanger;
use support::hamcrest::assert_that;
#[test]
fn profile_override_gated() {

View file

@ -1,6 +1,6 @@
use cargotest::is_nightly;
use cargotest::support::{execs, project, Project};
use hamcrest::assert_that;
use support::is_nightly;
use support::{execs, project, Project};
use support::hamcrest::assert_that;
// These tests try to exercise exactly which profiles are selected for every
// target.

View file

@ -1,8 +1,8 @@
use std::env;
use cargotest::is_nightly;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::is_nightly;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn profile_overrides() {

View file

@ -2,12 +2,12 @@ use std::io::prelude::*;
use std::fs::{self, File};
use std::io::SeekFrom;
use cargotest::ChannelChanger;
use cargotest::support::git::repo;
use cargotest::support::paths;
use cargotest::support::{execs, project, publish};
use support::ChannelChanger;
use support::git::repo;
use support::paths;
use support::{execs, project, publish};
use flate2::read::GzDecoder;
use hamcrest::assert_that;
use support::hamcrest::assert_that;
use tar::Archive;
#[test]

View file

@ -1,5 +1,5 @@
use cargotest::support::{basic_bin_manifest, execs, main_file, project};
use hamcrest::assert_that;
use support::{basic_bin_manifest, execs, main_file, project};
use support::hamcrest::assert_that;
static MANIFEST_OUTPUT: &'static str = r#"
{

View file

@ -3,12 +3,12 @@ use std::io::prelude::*;
use std::path::PathBuf;
use cargo::util::paths::remove_dir_all;
use cargotest::cargo_process;
use cargotest::support::git;
use cargotest::support::paths::{self, CargoPathExt};
use cargotest::support::registry::{self, Package};
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::cargo_process;
use support::git;
use support::paths::{self, CargoPathExt};
use support::registry::{self, Package};
use support::{execs, project};
use support::hamcrest::assert_that;
use url::Url;
fn registry_path() -> PathBuf {
@ -762,7 +762,7 @@ fn update_lockfile() {
#[test]
fn update_offline() {
use cargotest::ChannelChanger;
use support::ChannelChanger;
let p = project()
.file(
"Cargo.toml",

View file

@ -1,9 +1,9 @@
use cargotest::ChannelChanger;
use cargotest::support::git;
use cargotest::support::paths;
use cargotest::support::registry::Package;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::ChannelChanger;
use support::git;
use support::paths;
use support::registry::Package;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn gated() {

View file

@ -1,7 +1,7 @@
use cargotest::is_nightly;
use cargotest::install::{cargo_home, has_installed_exe};
use cargotest::support::{execs, project};
use hamcrest::{assert_that, existing_file, is_not};
use support::is_nightly;
use support::install::{cargo_home, has_installed_exe};
use support::{execs, project};
use support::hamcrest::{assert_that, existing_file, is_not};
#[test]
fn build_bin_default_features() {

View file

@ -1,6 +1,6 @@
use std::collections::{BTreeMap, HashSet};
use hamcrest::{assert_that, contains, is_not};
use support::hamcrest::{assert_that, contains, is_not};
use cargo::core::source::{GitReference, SourceId};
use cargo::core::dependency::Kind::{self, Development};
@ -8,9 +8,9 @@ use cargo::core::{Dependency, PackageId, Registry, Summary, enable_nightly_featu
use cargo::util::{CargoResult, Config, ToUrl};
use cargo::core::resolver::{self, Method};
use cargotest::ChannelChanger;
use cargotest::support::{execs, project};
use cargotest::support::registry::Package;
use support::ChannelChanger;
use support::{execs, project};
use support::registry::Package;
fn resolve(
pkg: &PackageId,

View file

@ -1,7 +1,7 @@
use cargo::util::paths::dylib_path_envvar;
use cargotest::{self, ChannelChanger};
use cargotest::support::{execs, project, Project, path2url};
use hamcrest::{assert_that, existing_file};
use support::{self, ChannelChanger};
use support::{execs, project, Project, path2url};
use support::hamcrest::{assert_that, existing_file};
#[test]
fn simple() {
@ -596,7 +596,7 @@ fn autodiscover_examples_project(rust_edition: &str, autoexamples: Option<bool>)
#[test]
fn run_example_autodiscover_2015() {
if !cargotest::is_nightly() {
if !support::is_nightly() {
return;
}
@ -631,7 +631,7 @@ error: no example target named `a`
#[test]
fn run_example_autodiscover_2015_with_autoexamples_enabled() {
if !cargotest::is_nightly() {
if !support::is_nightly() {
return;
}
@ -656,7 +656,7 @@ fn run_example_autodiscover_2015_with_autoexamples_enabled() {
#[test]
fn run_example_autodiscover_2015_with_autoexamples_disabled() {
if !cargotest::is_nightly() {
if !support::is_nightly() {
return;
}
@ -674,7 +674,7 @@ fn run_example_autodiscover_2015_with_autoexamples_disabled() {
#[test]
fn run_example_autodiscover_2018() {
if !cargotest::is_nightly() {
if !support::is_nightly() {
return;
}

View file

@ -1,5 +1,5 @@
use cargotest::support::{basic_bin_manifest, basic_lib_manifest, execs, project};
use hamcrest::assert_that;
use support::{basic_bin_manifest, basic_lib_manifest, execs, project};
use support::hamcrest::assert_that;
const CARGO_RUSTC_ERROR: &'static str =
"[ERROR] extra arguments to `rustc` can only be passed to one target, consider filtering

View file

@ -1,6 +1,6 @@
use cargotest::support::{execs, project};
use cargotest::support::paths::CargoPathExt;
use hamcrest::assert_that;
use support::{execs, project};
use support::paths::CargoPathExt;
use support::hamcrest::assert_that;
use std::env;
#[test]

View file

@ -1,5 +1,5 @@
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn rustdoc_simple() {

View file

@ -1,5 +1,5 @@
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn parses_env() {

View file

@ -1,9 +1,9 @@
use std::io::Write;
use std::fs::{self, File};
use cargotest::rustc_host;
use cargotest::support::{execs, paths, project, project_in_home};
use hamcrest::assert_that;
use support::rustc_host;
use support::{execs, paths, project, project_in_home};
use support::hamcrest::assert_that;
#[test]
fn env_rustflags_normal_source() {

View file

@ -3,11 +3,11 @@ use std::io::prelude::*;
use std::path::PathBuf;
use cargo::util::ProcessBuilder;
use cargotest;
use cargotest::support::execs;
use cargotest::support::git::repo;
use cargotest::support::paths;
use hamcrest::assert_that;
use support;
use support::execs;
use support::git::repo;
use support::paths;
use support::hamcrest::assert_that;
use url::Url;
fn registry_path() -> PathBuf {
@ -43,7 +43,7 @@ fn setup() {
}
fn cargo_process(s: &str) -> ProcessBuilder {
let mut b = cargotest::cargo_process();
let mut b = support::cargo_process();
b.arg(s);
b
}

View file

@ -2,11 +2,11 @@
//! in the output, their arguments are quoted properly
//! so that the command can be run in a terminal
use cargotest::support::{
use support::{
execs,
project,
};
use hamcrest::assert_that;
use support::hamcrest::assert_that;
#[test]
fn features_are_quoted() {

View file

@ -4,11 +4,11 @@ use std::path::PathBuf;
use std::process::Command;
use git2;
use cargotest::support::{execs, project};
use cargotest::support::registry::Package;
use cargotest::support::paths;
use cargotest::support::git;
use hamcrest::assert_that;
use support::{execs, project};
use support::registry::Package;
use support::paths;
use support::git;
use support::hamcrest::assert_that;
use url::Url;

View file

@ -3,7 +3,7 @@ use std::process::Command;
use std::sync::{Once, ONCE_INIT};
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use cargotest::support::{basic_bin_manifest, main_file, project};
use support::{basic_bin_manifest, main_file, project};
pub fn disabled() -> bool {
// First, disable if ./configure requested so

View file

@ -6,7 +6,7 @@ use cargo::util::ProcessError;
use git2;
use url::Url;
use cargotest::support::{project, Project, ProjectBuilder, path2url};
use support::{project, Project, ProjectBuilder, path2url};
#[must_use]
pub struct RepoBuilder {

View file

@ -1,9 +1,9 @@
use std::fmt;
use std::path::{Path, PathBuf};
use hamcrest::{existing_file, MatchResult, Matcher};
use support::hamcrest::{existing_file, MatchResult, Matcher};
use cargotest::support::paths;
use support::paths;
pub use self::InstalledExe as has_installed_exe;

View file

@ -1,3 +1,87 @@
/*
# Introduction To `support`
Cargo has a wide variety of integration tests that execute the `cargo` binary
and verify its behavior. The `support` module contains many helpers to make
this process easy.
The general form of a test involves creating a "project", running cargo, and
checking the result. Projects are created with the `ProjectBuilder` where you
specify some files to create. The general form looks like this:
```
let p = project()
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/main.rs", r#"fn main() { println!("hi!"); }"#)
.build();
```
To run cargo, call the `cargo` method and use the `hamcrest` matchers to check
the output.
```
assert_that(
p.cargo("run --bin foo"),
execs()
.with_status(0)
.with_stderr(
"\
[COMPILING] foo [..]
[FINISHED] [..]
[RUNNING] `target[/]debug[/]foo`
",
)
.with_stdout("hi!"),
);
```
The project creates a mini sandbox under the "cargo integration test"
directory with each test getting a separate directory such as
`/path/to/cargo/target/cit/t123/`. Each project appears as a separate
directory. There is also an empty `home` directory created that will be used
as a home directory instead of your normal home directory.
See `support::lines_match` for an explanation of the string pattern matching.
See the `hamcrest` module for other matchers like
`is_not(existing_file(path))`. This is not the actual hamcrest library, but
instead a lightweight subset of matchers that are used in cargo tests.
Browse the `pub` functions in the `support` module for a variety of other
helpful utilities.
## Testing Nightly Features
If you are testing a Cargo feature that only works on "nightly" cargo, then
you need to call `masquerade_as_nightly_cargo` on the process builder like
this:
```
p.cargo("build").masquerade_as_nightly_cargo()
```
If you are testing a feature that only works on *nightly rustc* (such as
benchmarks), then you should exit the test if it is not running with nightly
rust, like this:
```
if !is_nightly() {
return;
}
```
## Platform-specific Notes
When checking output, be sure to use `[/]` when checking paths to
automatically support backslashes on Windows.
Be careful when executing binaries on Windows. You should not rename, delete,
or overwrite a binary immediately after running it. Under some conditions
Windows will fail with errors like "directory not empty" or "failed to remove"
or "access is denied".
*/
use std::env;
use std::ffi::OsStr;
use std::fmt;
@ -7,16 +91,17 @@ use std::os;
use std::path::{Path, PathBuf};
use std::process::Output;
use std::str;
use std::time::Duration;
use std::usize;
use cargo::util::ProcessBuilder;
use cargo::util::ProcessError;
use hamcrest as ham;
use cargo::util::{ProcessBuilder, ProcessError, Rustc};
use cargo;
use serde_json::{self, Value};
use url::Url;
use tempfile::TempDir;
use url::Url;
use cargotest::support::paths::CargoPathExt;
use self::hamcrest as ham;
use self::paths::CargoPathExt;
macro_rules! t {
($e:expr) => {
@ -29,6 +114,7 @@ macro_rules! t {
pub mod cross_compile;
pub mod git;
pub mod hamcrest;
pub mod paths;
pub mod publish;
pub mod registry;
@ -263,7 +349,7 @@ impl Project {
/// execs().with_status(0).with_stdout("bar\n"),
/// );
pub fn process<T: AsRef<OsStr>>(&self, program: T) -> ProcessBuilder {
let mut p = ::cargotest::process(program);
let mut p = ::support::process(program);
p.cwd(self.root());
return p;
}
@ -1078,9 +1164,9 @@ impl<'a> ham::Matcher<&'a mut ProcessBuilder> for Execs {
output: Some(ref out),
..
}) = err
{
return self.match_output(out);
}
{
return self.match_output(out);
}
let mut s = format!("could not exec process {}: {}", process, e);
for cause in e.causes() {
s.push_str(&format!("\ncaused by: {}", cause));
@ -1199,3 +1285,88 @@ fn substitute_macros(input: &str) -> String {
}
return result;
}
pub mod install;
thread_local!(
pub static RUSTC: Rustc = Rustc::new(
PathBuf::from("rustc"),
None,
Path::new("should be path to rustup rustc, but we don't care in tests"),
None,
).unwrap()
);
/// The rustc host such as `x86_64-unknown-linux-gnu`.
pub fn rustc_host() -> String {
RUSTC.with(|r| r.host.clone())
}
pub fn is_nightly() -> bool {
RUSTC.with(|r| r.verbose_version.contains("-nightly") || r.verbose_version.contains("-dev"))
}
pub fn process<T: AsRef<OsStr>>(t: T) -> cargo::util::ProcessBuilder {
_process(t.as_ref())
}
fn _process(t: &OsStr) -> cargo::util::ProcessBuilder {
let mut p = cargo::util::process(t);
p.cwd(&paths::root())
.env_remove("CARGO_HOME")
.env("HOME", paths::home())
.env("CARGO_HOME", paths::home().join(".cargo"))
.env("__CARGO_TEST_ROOT", paths::root())
// Force cargo to think it's on the stable channel for all tests, this
// should hopefully not surprise us as we add cargo features over time and
// cargo rides the trains.
.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "stable")
// For now disable incremental by default as support hasn't ridden to the
// stable channel yet. Once incremental support hits the stable compiler we
// can switch this to one and then fix the tests.
.env("CARGO_INCREMENTAL", "0")
// This env var can switch the git backend from libgit2 to git2-curl, which
// can tweak error messages and cause some tests to fail, so let's forcibly
// remove it.
.env_remove("CARGO_HTTP_CHECK_REVOKE")
.env_remove("__CARGO_DEFAULT_LIB_METADATA")
.env_remove("RUSTC")
.env_remove("RUSTDOC")
.env_remove("RUSTC_WRAPPER")
.env_remove("RUSTFLAGS")
.env_remove("XDG_CONFIG_HOME") // see #2345
.env("GIT_CONFIG_NOSYSTEM", "1") // keep trying to sandbox ourselves
.env_remove("EMAIL")
.env_remove("MFLAGS")
.env_remove("MAKEFLAGS")
.env_remove("CARGO_MAKEFLAGS")
.env_remove("GIT_AUTHOR_NAME")
.env_remove("GIT_AUTHOR_EMAIL")
.env_remove("GIT_COMMITTER_NAME")
.env_remove("GIT_COMMITTER_EMAIL")
.env_remove("CARGO_TARGET_DIR") // we assume 'target'
.env_remove("MSYSTEM"); // assume cmd.exe everywhere on windows
return p;
}
pub trait ChannelChanger: Sized {
fn masquerade_as_nightly_cargo(&mut self) -> &mut Self;
}
impl ChannelChanger for cargo::util::ProcessBuilder {
fn masquerade_as_nightly_cargo(&mut self) -> &mut Self {
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
}
}
pub fn cargo_process() -> cargo::util::ProcessBuilder {
process(&cargo_exe())
}
pub fn sleep_ms(ms: u64) {
::std::thread::sleep(Duration::from_millis(ms));
}

View file

@ -2,8 +2,8 @@ use std::path::PathBuf;
use std::io::prelude::*;
use std::fs::{self, File};
use cargotest::support::paths;
use cargotest::support::git::{repo, Repository};
use support::paths;
use support::git::{repo, Repository};
use url::Url;

View file

@ -11,8 +11,8 @@ use hex;
use tar::{Builder, Header};
use url::Url;
use cargotest::support::paths;
use cargotest::support::git::repo;
use support::paths;
use support::git::repo;
pub fn registry_path() -> PathBuf {
paths::root().join("registry")

View file

@ -4,11 +4,11 @@ use std::str;
use cargo;
use cargo::util::process;
use cargotest::support::paths::CargoPathExt;
use cargotest::support::registry::Package;
use cargotest::support::{basic_bin_manifest, basic_lib_manifest, cargo_exe, execs, project};
use cargotest::{is_nightly, rustc_host, sleep_ms};
use hamcrest::{assert_that, existing_file, is_not};
use support::paths::CargoPathExt;
use support::registry::Package;
use support::{basic_bin_manifest, basic_lib_manifest, cargo_exe, execs, project};
use support::{is_nightly, rustc_host, sleep_ms};
use support::hamcrest::{assert_that, existing_file, is_not};
#[test]
fn cargo_test_simple() {

View file

@ -1,6 +1,6 @@
use cargotest::rustc_host;
use cargotest::support::{execs, project, path2url};
use hamcrest::assert_that;
use support::rustc_host;
use support::{execs, project, path2url};
use support::hamcrest::assert_that;
#[test]
fn pathless_tools() {

View file

@ -1,9 +1,9 @@
use std::fs::File;
use std::io::prelude::*;
use cargotest::support::{execs, project};
use cargotest::support::registry::Package;
use hamcrest::assert_that;
use support::{execs, project};
use support::registry::Package;
use support::hamcrest::assert_that;
#[test]
fn minor_update_two_places() {

View file

@ -1,5 +1,5 @@
use cargotest::support::{basic_bin_manifest, execs, main_file, project};
use hamcrest::assert_that;
use support::{basic_bin_manifest, execs, main_file, project};
use support::hamcrest::assert_that;
fn verify_project_success_output() -> String {
r#"{"success":"true"}"#.into()

View file

@ -1,6 +1,6 @@
use cargo;
use cargotest::support::{execs, project};
use hamcrest::assert_that;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn simple() {

View file

@ -1,6 +1,6 @@
use cargotest::support::{execs, project, Project};
use cargotest::support::registry::Package;
use hamcrest::assert_that;
use support::{execs, project, Project};
use support::registry::Package;
use support::hamcrest::assert_that;
static WARNING1: &'static str = "Hello! I'm a warning. :)";
static WARNING2: &'static str = "And one more!";

View file

@ -2,10 +2,10 @@ use std::env;
use std::fs::{self, File};
use std::io::{Read, Write};
use cargotest::sleep_ms;
use cargotest::support::{basic_lib_manifest, execs, git, project};
use cargotest::support::registry::Package;
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
use support::sleep_ms;
use support::{basic_lib_manifest, execs, git, project};
use support::registry::Package;
use support::hamcrest::{assert_that, existing_dir, existing_file, is_not};
#[test]
fn simple_explicit() {