-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
79 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
|
||
pub fn get_included_str() -> &'static str { | ||
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/include/included_file.rs.inc")) | ||
include_str!(concat!( | ||
env!("CARGO_MANIFEST_DIR"), | ||
"/include/included_file.rs.inc" | ||
)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,8 @@ | |
|
||
#![feature(test)] | ||
|
||
extern crate test; | ||
extern crate fibonacci; | ||
extern crate test; | ||
|
||
use test::Bencher; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pub fn print() -> String { | ||
"Hello Windows!".to_owned() | ||
"Hello Windows!".to_owned() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
fn main() { | ||
println!("cargo:rustc-env=CARGO_PKG_NAME_FROM_BUILD_SCRIPT={}", env!("CARGO_PKG_NAME")); | ||
println!("cargo:rustc-env=CARGO_CRATE_NAME_FROM_BUILD_SCRIPT={}", env!("CARGO_CRATE_NAME")); | ||
println!( | ||
"cargo:rustc-env=CARGO_PKG_NAME_FROM_BUILD_SCRIPT={}", | ||
env!("CARGO_PKG_NAME") | ||
); | ||
println!( | ||
"cargo:rustc-env=CARGO_CRATE_NAME_FROM_BUILD_SCRIPT={}", | ||
env!("CARGO_CRATE_NAME") | ||
); | ||
println!("cargo:rustc-env=HAS_TRAILING_SLASH=foo\\"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
#[test] | ||
fn cargo_env_vars() { | ||
assert_eq!(env!("CARGO_PKG_NAME"), "cargo-env-vars-custom-crate-name-test"); | ||
assert_eq!( | ||
env!("CARGO_PKG_NAME"), | ||
"cargo-env-vars-custom-crate-name-test" | ||
); | ||
assert_eq!(env!("CARGO_CRATE_NAME"), "custom_crate_name"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
#[test] | ||
pub fn test_manifest_dir() { | ||
let actual = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/manifest_dir_file.txt")); | ||
let actual = include_str!(concat!( | ||
env!("CARGO_MANIFEST_DIR"), | ||
"/src/manifest_dir_file.txt" | ||
)); | ||
let expected = "This file tests that CARGO_MANIFEST_DIR is set for the build environment\n"; | ||
assert_eq!(actual, expected); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
#[test] | ||
fn run() { | ||
let path = env!("CARGO_BIN_EXE_hello-world"); | ||
let output = std::process::Command::new(path).output().expect("Failed to run process"); | ||
let output = std::process::Command::new(path) | ||
.output() | ||
.expect("Failed to run process"); | ||
assert_eq!(&b"Hello world\n"[..], output.stdout.as_slice()); | ||
|
||
// Test the `env` attribute of `rust_test` at run time | ||
assert_eq!(std::env::var("FERRIS_SAYS").unwrap(), "Hello fellow Rustaceans!"); | ||
assert_eq!( | ||
std::env::var("FERRIS_SAYS").unwrap(), | ||
"Hello fellow Rustaceans!" | ||
); | ||
|
||
// Test the behavior of `rootpath` and that a binary can be found relative to current_dir | ||
let hello_world_bin = std::path::PathBuf::from(std::env::var_os("HELLO_WORLD_BIN_ROOTPATH").unwrap()); | ||
let hello_world_bin = | ||
std::path::PathBuf::from(std::env::var_os("HELLO_WORLD_BIN_ROOTPATH").unwrap()); | ||
assert_eq!( | ||
hello_world_bin.as_path(), | ||
hello_world_bin.as_path(), | ||
std::path::Path::new("test/test_env/hello-world"), | ||
); | ||
assert!(!hello_world_bin.is_absolute()); | ||
assert!(hello_world_bin.exists()); | ||
|
||
// Ensure `execpath` expanded variables map to real files and have absolute paths | ||
let hello_world_src = std::path::PathBuf::from(std::env::var("HELLO_WORLD_SRC_EXECPATH").unwrap()); | ||
let hello_world_src = | ||
std::path::PathBuf::from(std::env::var("HELLO_WORLD_SRC_EXECPATH").unwrap()); | ||
assert!(hello_world_src.is_absolute()); | ||
assert!(hello_world_src.exists()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
fn main() { | ||
println!("cargo:rustc-link-lib=alias:shell32"); | ||
println!("cargo:rustc-link-lib=alias:shell32"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ extern "C" { | |
} | ||
fn main() { | ||
println!("{}", unsafe { native_dep() }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
pub fn main() { dbg!(42); } | ||
pub fn main() { | ||
dbg!(42); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ extern "C" { | |
} | ||
fn main() { | ||
println!("{}", unsafe { native_dep() }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ extern "C" { | |
} | ||
pub fn use_native_dep() { | ||
println!("{}", unsafe { native_dep() }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters