-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit-id:289e98b3
- Loading branch information
Showing
4 changed files
with
195 additions
and
26 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
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,118 @@ | ||
use assert_fs::TempDir; | ||
use indoc::indoc; | ||
|
||
use crate::support::command::Scarb; | ||
use crate::support::project_builder::ProjectBuilder; | ||
|
||
#[test] | ||
fn compile_cairo_plugin() { | ||
let t = TempDir::new().unwrap(); | ||
ProjectBuilder::start() | ||
.name("hello") | ||
.version("1.0.0") | ||
.manifest_extra(r#"[cairo-plugin]"#) | ||
.build(&t); | ||
|
||
Scarb::quick_snapbox() | ||
.arg("build") | ||
.current_dir(&t) | ||
.assert() | ||
.failure() | ||
.stdout_matches(indoc! {r#" | ||
error: compiling Cairo plugin packages is possible yet | ||
"#}); | ||
} | ||
|
||
#[test] | ||
fn compile_known_builtin() { | ||
let t = TempDir::new().unwrap(); | ||
ProjectBuilder::start() | ||
.name("hello") | ||
.version("1.0.0") | ||
.manifest_extra(indoc! {r#" | ||
[cairo-plugin] | ||
builtin = "starknet" | ||
"#}) | ||
.build(&t); | ||
|
||
Scarb::quick_snapbox() | ||
.arg("build") | ||
.current_dir(&t) | ||
.assert() | ||
.success() | ||
.stdout_matches(indoc! {r#" | ||
[..] Finished release target(s) in [..] | ||
"#}); | ||
} | ||
|
||
#[test] | ||
fn compile_unknown_builtin() { | ||
let t = TempDir::new().unwrap(); | ||
ProjectBuilder::start() | ||
.name("hello") | ||
.version("1.0.0") | ||
.manifest_extra(indoc! {r#" | ||
[cairo-plugin] | ||
builtin = "i_definitely_do_not_exist" | ||
"#}) | ||
.build(&t); | ||
|
||
Scarb::quick_snapbox() | ||
.arg("build") | ||
.current_dir(&t) | ||
.assert() | ||
.success() | ||
.stdout_matches(indoc! {r#" | ||
[..] Finished release target(s) in [..] | ||
"#}); | ||
} | ||
|
||
#[test] | ||
fn compile_cairo_plugin_with_lib_target() { | ||
let t = TempDir::new().unwrap(); | ||
ProjectBuilder::start() | ||
.name("hello") | ||
.version("1.0.0") | ||
.manifest_extra(indoc! {r#" | ||
[lib] | ||
[cairo-plugin] | ||
"#}) | ||
.build(&t); | ||
|
||
Scarb::quick_snapbox() | ||
.arg("build") | ||
.current_dir(&t) | ||
.assert() | ||
.failure() | ||
.stdout_matches(indoc! {r#" | ||
error: failed to parse manifest at `[..]/Scarb.toml` | ||
Caused by: | ||
target `cairo-plugin` cannot be mixed with other targets | ||
"#}); | ||
} | ||
|
||
#[test] | ||
fn compile_cairo_plugin_with_other_target() { | ||
let t = TempDir::new().unwrap(); | ||
ProjectBuilder::start() | ||
.name("hello") | ||
.version("1.0.0") | ||
.manifest_extra(indoc! {r#" | ||
[cairo-plugin] | ||
[[target.starknet-contract]] | ||
"#}) | ||
.build(&t); | ||
|
||
Scarb::quick_snapbox() | ||
.arg("build") | ||
.current_dir(&t) | ||
.assert() | ||
.failure() | ||
.stdout_matches(indoc! {r#" | ||
error: failed to parse manifest at `[..]/Scarb.toml` | ||
Caused by: | ||
target `cairo-plugin` cannot be mixed with other targets | ||
"#}); | ||
} |
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,6 @@ | ||
mod add; | ||
mod build; | ||
mod build_cairo_plugin; | ||
mod build_starknet_contract; | ||
mod build_targets; | ||
mod clean; | ||
|