-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: for verifying changes in manifest file (#804)
* Prepare 0.2.1 (#817) * add test for verifying changes in manifest file * rework tests * update manifest file after rebase * clean up * fix generated file path * make clippy overlords happy * remove unnecessary changes * use symbolic link instead of copying --------- Co-authored-by: Tarrence van As <tarrencev@users.noreply.github.com>
- Loading branch information
Showing
9 changed files
with
1,113 additions
and
11 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,4 @@ | ||
/target | ||
**/target | ||
workspace | ||
.idea/ | ||
dojo.iml | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,3 +187,7 @@ impl Manifest { | |
Ok(()) | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
#[path = "manifest_test.rs"] | ||
mod test; |
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,35 @@ | ||
use std::path::Path; | ||
use std::{env, fs}; | ||
|
||
use cairo_lang_utils::ordered_hash_map::OrderedHashMap; | ||
use dojo_test_utils::compiler::build_test_config; | ||
use scarb::ops; | ||
|
||
cairo_lang_test_utils::test_file_test!( | ||
manifest_file, | ||
"src/manifest_test_data/", | ||
{ | ||
manifest: "manifest", | ||
}, | ||
test_manifest_file | ||
); | ||
|
||
pub fn test_manifest_file( | ||
_inputs: &OrderedHashMap<String, String>, | ||
) -> OrderedHashMap<String, String> { | ||
let config = | ||
build_test_config("./src/manifest_test_data/manifest_test_crate/Scarb.toml").unwrap(); | ||
let ws = ops::read_workspace(config.manifest_path(), &config).unwrap(); | ||
|
||
let packages = ws.members().map(|p| p.id).collect(); | ||
ops::compile(packages, &ws).unwrap_or_else(|op| panic!("Error compiling: {op:?}")); | ||
|
||
let target_dir = config.target_dir().path_existent().unwrap(); | ||
|
||
let generated_manifest_path = | ||
Path::new(target_dir).join(config.profile().as_str()).join("manifest.json"); | ||
|
||
let generated_file = fs::read_to_string(generated_manifest_path).unwrap(); | ||
|
||
OrderedHashMap::from([("expected_manifest_file".into(), generated_file)]) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.