This repository has been archived by the owner on Jan 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The simple test solution is on the ebuild generated for cargo-ebuild itself. After editing cargo.toml or `cargo update` is necessary to upadate the test in `test/integration.rs`.
- Loading branch information
Showing
4 changed files
with
198 additions
and
48 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,2 +1,3 @@ | ||
target | ||
*.rs.bk | ||
*.ebuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,131 @@ | ||
extern crate assert_cli; | ||
extern crate tempdir; | ||
|
||
use std::fs::File; | ||
use std::io::prelude::*; | ||
use tempdir::TempDir; | ||
|
||
#[test] | ||
fn build() { | ||
let ebuild_name = format!("cargo-ebuild-{}.ebuild", env!("CARGO_PKG_VERSION")); | ||
|
||
let build_dir = TempDir::new("build").unwrap(); | ||
let build_path = build_dir.path().join(&ebuild_name); | ||
|
||
assert_cli::Assert::main_binary() | ||
.with_args(&["build", "-o", build_dir.path().to_str().unwrap()]) | ||
.stdout() | ||
.is((format!("Wrote: {}", build_path.display())).as_str()) | ||
.unwrap(); | ||
|
||
let mut build_file = match File::open(build_path) { | ||
Err(why) => panic!("couldn't open generated ebuild: {}", why), | ||
Ok(f) => f, | ||
}; | ||
|
||
let mut new_ebuild = String::new(); | ||
build_file.read_to_string(&mut new_ebuild).unwrap(); | ||
|
||
assert_eq!(new_ebuild, TEST_EBUILD); | ||
} | ||
|
||
|
||
const TEST_EBUILD: &str = r#"# Copyright 2017-2018 Gentoo Foundation | ||
# Distributed under the terms of the GNU General Public License v2 | ||
# Auto-Generated by cargo-ebuild 0.1.6-pre | ||
EAPI=6 | ||
CRATES=" | ||
aho-corasick-0.6.4 | ||
ansi_term-0.11.0 | ||
assert_cli-0.6.1 | ||
atty-0.2.10 | ||
backtrace-0.3.8 | ||
backtrace-sys-0.1.23 | ||
bitflags-1.0.3 | ||
cargo-ebuild-0.1.6-pre | ||
cargo_metadata-0.5.6 | ||
cc-1.0.17 | ||
cfg-if-0.1.3 | ||
clap-2.31.2 | ||
colored-1.6.0 | ||
difference-2.0.0 | ||
dtoa-0.4.2 | ||
env_logger-0.5.10 | ||
environment-0.1.1 | ||
error-chain-0.11.0 | ||
failure-0.1.1 | ||
failure_derive-0.1.1 | ||
fuchsia-zircon-0.3.3 | ||
fuchsia-zircon-sys-0.3.3 | ||
human-panic-1.0.0 | ||
humantime-1.1.1 | ||
itoa-0.4.1 | ||
lazy_static-0.2.11 | ||
lazy_static-1.0.1 | ||
libc-0.2.42 | ||
log-0.4.2 | ||
memchr-2.0.1 | ||
os_type-2.0.0 | ||
proc-macro2-0.4.6 | ||
quick-error-1.2.2 | ||
quote-0.3.15 | ||
quote-0.6.3 | ||
rand-0.4.2 | ||
redox_syscall-0.1.40 | ||
redox_termios-0.1.1 | ||
regex-0.2.11 | ||
regex-1.0.0 | ||
regex-syntax-0.5.6 | ||
regex-syntax-0.6.0 | ||
remove_dir_all-0.5.1 | ||
rustc-demangle-0.1.8 | ||
semver-0.9.0 | ||
semver-parser-0.7.0 | ||
serde-1.0.66 | ||
serde_derive-1.0.66 | ||
serde_json-1.0.20 | ||
strsim-0.7.0 | ||
structopt-0.2.10 | ||
structopt-derive-0.2.10 | ||
syn-0.11.11 | ||
syn-0.14.2 | ||
synom-0.11.3 | ||
synstructure-0.6.1 | ||
tempdir-0.3.7 | ||
termcolor-0.3.6 | ||
termion-1.5.1 | ||
textwrap-0.9.0 | ||
thread_local-0.3.5 | ||
time-0.1.40 | ||
toml-0.4.6 | ||
ucd-util-0.1.1 | ||
unicode-width-0.1.5 | ||
unicode-xid-0.0.4 | ||
unicode-xid-0.1.0 | ||
unreachable-1.0.0 | ||
utf8-ranges-1.0.0 | ||
uuid-0.6.5 | ||
vec_map-0.8.1 | ||
void-1.0.2 | ||
winapi-0.3.5 | ||
winapi-i686-pc-windows-gnu-0.4.0 | ||
winapi-x86_64-pc-windows-gnu-0.4.0 | ||
wincolor-0.1.6" | ||
inherit cargo | ||
DESCRIPTION="Generates an ebuild for a package using the in-tree eclasses." | ||
HOMEPAGE="https://github.com/cardoe/cargo-ebuild" | ||
SRC_URI="$(cargo_crate_uris ${CRATES})" | ||
RESTRICT="mirror" | ||
LICENSE="MIT/Apache-2.0" # Update to proper Gentoo format | ||
SLOT="0" | ||
KEYWORDS="~amd64" | ||
IUSE="" | ||
DEPEND="" | ||
RDEPEND="" | ||
"#; |