Skip to content

Commit

Permalink
rebamse main
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Oct 24, 2023
1 parent ff603ca commit 44cab39
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 70 deletions.
19 changes: 0 additions & 19 deletions crates/dojo-lang/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,24 +200,6 @@ pub fn collect_external_crate_ids(
.collect::<Vec<_>>()
}

<<<<<<< HEAD
#[test]
fn test_compiler() {
use dojo_test_utils::compiler::build_test_config;
use scarb::ops;
use scarb::ops::CompileOpts;

let config = build_test_config("../../examples/spawn-and-move/Scarb.toml").unwrap();
let ws = ops::read_workspace(config.manifest_path(), &config)
.unwrap_or_else(|op| panic!("Error building workspace: {op:?}"));
let packages = ws.members().map(|p| p.id).collect();
ops::compile(
packages,
CompileOpts { include_targets: vec![], exclude_targets: vec![TargetKind::TEST] },
&ws,
)
.unwrap_or_else(|op| panic!("Error compiling: {op:?}"))
=======
fn update_manifest(
manifest: &mut dojo_world::manifest::Manifest,
db: &dyn SemanticGroup,
Expand Down Expand Up @@ -391,5 +373,4 @@ fn do_update_manifest(
}

Ok(())
>>>>>>> eb0865dd (prevent overwrite on build)
}
30 changes: 24 additions & 6 deletions crates/dojo-lang/src/compiler_test.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
use std::path::Path;
use std::{env, fs};

use cairo_lang_test_utils::parse_test_file::TestRunnerResult;
use cairo_lang_utils::ordered_hash_map::OrderedHashMap;
use dojo_test_utils::compiler::build_test_config;
use scarb::ops;
use scarb::core::TargetKind;
use scarb::ops::{self, CompileOpts};

#[test]
fn test_compiler() {
let config = build_test_config("../../examples/spawn-and-move/Scarb.toml").unwrap();
let ws = ops::read_workspace(config.manifest_path(), &config).unwrap();
let packages = ws.members().map(|p| p.id).collect();
assert!(ops::compile(packages, &ws).is_ok(), "compilation failed");
assert!(
ops::compile(
packages,
CompileOpts { include_targets: vec![], exclude_targets: vec![TargetKind::TEST] },
&ws
)
.is_ok(),
"compilation failed"
);
}

cairo_lang_test_utils::test_file_test!(
Expand All @@ -25,19 +35,27 @@ cairo_lang_test_utils::test_file_test!(
pub fn test_manifest_file(
_inputs: &OrderedHashMap<String, String>,
_args: &OrderedHashMap<String, String>,
) -> Result<OrderedHashMap<String, String>, String> {
) -> TestRunnerResult {
let config = build_test_config("./src/manifest_test_data/spawn-and-move/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:?}"));
ops::compile(
packages,
CompileOpts { include_targets: vec![], exclude_targets: vec![TargetKind::TEST] },
&ws,
)
.unwrap_or_else(|op| panic!("Error compiling: {op:?}"));

let target_dir = config.target_dir().path_existent().unwrap();
let target_dir = config.target_dir_override().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();

Ok(OrderedHashMap::from([("expected_manifest_file".into(), generated_file)]))
TestRunnerResult::success(OrderedHashMap::from([(
"expected_manifest_file".into(),
generated_file,
)]))
}
45 changes: 0 additions & 45 deletions crates/dojo-lang/src/manifest_test.rs

This file was deleted.

0 comments on commit 44cab39

Please sign in to comment.