From 34787723fea08706b96e35ed8ad9d91c1061ec60 Mon Sep 17 00:00:00 2001 From: Kaya Gokalp Date: Sat, 2 Mar 2024 02:00:38 -0800 Subject: [PATCH 1/5] feat: collect log type information from forc-pkg --- forc-pkg/src/pkg.rs | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/forc-pkg/src/pkg.rs b/forc-pkg/src/pkg.rs index 4c323351209..5f86759db61 100644 --- a/forc-pkg/src/pkg.rs +++ b/forc-pkg/src/pkg.rs @@ -21,6 +21,7 @@ use petgraph::{ Directed, Direction, }; use serde::{Deserialize, Serialize}; +use std::env::args; use std::{ collections::{hash_map, BTreeSet, HashMap, HashSet}, fmt, @@ -31,6 +32,7 @@ use std::{ str::FromStr, sync::{atomic::AtomicBool, Arc}, }; +use sway_core::language::ty::{TyAstNodeContent, TyExpression, TyExpressionVariant}; pub use sway_core::Programs; use sway_core::{ abi_generation::{ @@ -49,9 +51,10 @@ use sway_core::{ transform::AttributeKind, BuildTarget, Engines, FinalizedEntry, LspConfig, }; +use sway_core::{TypeId, TypeInfo}; use sway_error::{error::CompileError, handler::Handler, warning::CompileWarning}; use sway_types::constants::{CORE, PRELUDE, STD}; -use sway_types::{Ident, Span, Spanned}; +use sway_types::{Ident, SourceId, Span, Spanned}; use sway_utils::{constants, time_expr, PerformanceData, PerformanceMetric}; use tracing::{debug, info}; @@ -162,6 +165,7 @@ pub struct PkgTestEntry { pub pass_condition: TestPassCondition, pub span: Span, pub file_path: Arc, + pub log_params: Vec<(SourceId, Option>)>, } /// The result of successfully compiling a workspace. @@ -2011,16 +2015,55 @@ impl PkgTestEntry { bail!("Invalid test argument(s) for test: {test_name}.") }?; + /// Given an AST node, checks: + /// - it is function, + /// - it is a log, + /// + /// If condition holds, returns type of log's param. + fn collect_log_type_from_decl( + expr: &TyExpression, + log_param_types: &mut Vec<(SourceId, Option>)>, + engines: &Engines, + ) { + if let TyExpressionVariant::FunctionApplication { + call_path, + arguments, + .. + } = &expr.expression + { + let suffix = call_path.suffix.to_string(); + if suffix == "log" { + let arg_type = arguments + .iter() + .map(|(_, arg_expr)| arg_expr.return_type) + .map(|type_id| engines.te().get(type_id)) + .next(); + log_param_types.push((expr.span.source_id().cloned().unwrap(), arg_type)); + } + } + } + + let mut log_params = Vec::new(); + for ast_node in test_function_decl.body.contents.iter() { + if let TyAstNodeContent::Expression(expr) = &ast_node.content { + // We found an expression node, try to extract the arguments if this is an assert. + collect_log_type_from_decl(expr, &mut log_params, engines); + } + } + let file_path = Arc::new( engines.se().get_path( span.source_id() .ok_or_else(|| anyhow::anyhow!("Missing span for test function"))?, ), ); + + println!("{log_params:?}"); Ok(Self { pass_condition, span, file_path, + log_params, }) } } From 60fc9a705fe94747f2ce5ccb350bbd3f8e1e5fbf Mon Sep 17 00:00:00 2001 From: Kaya Gokalp Date: Sat, 2 Mar 2024 13:41:22 -0800 Subject: [PATCH 2/5] add test for log collection --- forc-pkg/src/pkg.rs | 66 ++++++++++++++++++++---- forc-pkg/tests/test_pkg_entry/.gitignore | 2 + forc-pkg/tests/test_pkg_entry/Forc.lock | 13 +++++ forc-pkg/tests/test_pkg_entry/Forc.toml | 8 +++ forc-pkg/tests/test_pkg_entry/src/lib.sw | 8 +++ 5 files changed, 87 insertions(+), 10 deletions(-) create mode 100644 forc-pkg/tests/test_pkg_entry/.gitignore create mode 100644 forc-pkg/tests/test_pkg_entry/Forc.lock create mode 100644 forc-pkg/tests/test_pkg_entry/Forc.toml create mode 100644 forc-pkg/tests/test_pkg_entry/src/lib.sw diff --git a/forc-pkg/src/pkg.rs b/forc-pkg/src/pkg.rs index 5f86759db61..73a81a22b19 100644 --- a/forc-pkg/src/pkg.rs +++ b/forc-pkg/src/pkg.rs @@ -21,7 +21,6 @@ use petgraph::{ Directed, Direction, }; use serde::{Deserialize, Serialize}; -use std::env::args; use std::{ collections::{hash_map, BTreeSet, HashMap, HashSet}, fmt, @@ -34,6 +33,7 @@ use std::{ }; use sway_core::language::ty::{TyAstNodeContent, TyExpression, TyExpressionVariant}; pub use sway_core::Programs; +use sway_core::TypeInfo; use sway_core::{ abi_generation::{ evm_abi, @@ -51,7 +51,6 @@ use sway_core::{ transform::AttributeKind, BuildTarget, Engines, FinalizedEntry, LspConfig, }; -use sway_core::{TypeId, TypeInfo}; use sway_error::{error::CompileError, handler::Handler, warning::CompileWarning}; use sway_types::constants::{CORE, PRELUDE, STD}; use sway_types::{Ident, SourceId, Span, Spanned}; @@ -2797,13 +2796,11 @@ pub fn fuel_core_not_running(node_url: &str) -> anyhow::Error { mod test { use super::*; use regex::Regex; + use sway_types::integer_bits::IntegerBits; - fn setup_build_plan() -> BuildPlan { + fn setup_build_plan(path: &str) -> BuildPlan { let current_dir = env!("CARGO_MANIFEST_DIR"); - let manifest_dir = PathBuf::from(current_dir) - .parent() - .unwrap() - .join("test/src/e2e_vm_tests/test_programs/should_pass/forc/workspace_building/"); + let manifest_dir = PathBuf::from(current_dir).parent().unwrap().join(path); let manifest_file = ManifestFile::from_dir(manifest_dir).unwrap(); let member_manifests = manifest_file.member_manifests().unwrap(); let lock_path = manifest_file.lock_path().unwrap(); @@ -2817,9 +2814,54 @@ mod test { .unwrap() } + #[test] + fn test_collect_test_entry_logs() { + let current_dir = env!("CARGO_MANIFEST_DIR"); + let manifest_dir = format!("{current_dir}/tests/test_pkg_entry"); + let build_opts = BuildOpts { + pkg: PkgOpts { + path: Some(manifest_dir), + ..Default::default() + }, + build_target: BuildTarget::Fuel, + tests: true, + experimental: ExperimentalFlags { new_encoding: true }, + ..Default::default() + }; + let built_pkgs = build_with_options(build_opts).unwrap(); + let built_pkg = built_pkgs.expect_pkg().unwrap(); + let test_entry = built_pkg + .bytecode + .entries + .iter() + .find_map(|entry| { + if let PkgEntryKind::Test(test_entry) = &entry.kind { + Some(test_entry) + } else { + None + } + }) + .unwrap(); + + let log_params: Vec<_> = test_entry + .log_params + .iter() + .map(|(_, type_info)| type_info) + .collect(); + assert_eq!(log_params.len(), 1); + let type_info = log_params[0].clone().unwrap(); + + assert!(matches!( + type_info.as_ref(), + TypeInfo::UnsignedInteger(IntegerBits::SixtyFour) + )) + } + #[test] fn test_root_pkg_order() { - let build_plan = setup_build_plan(); + let build_plan = setup_build_plan( + "test/src/e2e_vm_tests/test_programs/should_pass/forc/workspace_building", + ); let graph = build_plan.graph(); let order: Vec = build_plan .member_nodes() @@ -2830,7 +2872,9 @@ mod test { #[test] fn test_visualize_with_url_prefix() { - let build_plan = setup_build_plan(); + let build_plan = setup_build_plan( + "test/src/e2e_vm_tests/test_programs/should_pass/forc/workspace_building", + ); let result = build_plan.visualize(Some("some-prefix::".to_string())); let re = Regex::new(r#"digraph \{ 0 \[ label = "test_contract" shape = box URL = "some-prefix::/[[:ascii:]]+/test_contract/Forc.toml"\] @@ -2846,7 +2890,9 @@ mod test { #[test] fn test_visualize_without_prefix() { - let build_plan = setup_build_plan(); + let build_plan = setup_build_plan( + "test/src/e2e_vm_tests/test_programs/should_pass/forc/workspace_building", + ); let result = build_plan.visualize(None); let expected = r#"digraph { 0 [ label = "test_contract" shape = box ] diff --git a/forc-pkg/tests/test_pkg_entry/.gitignore b/forc-pkg/tests/test_pkg_entry/.gitignore new file mode 100644 index 00000000000..77d3844f58c --- /dev/null +++ b/forc-pkg/tests/test_pkg_entry/.gitignore @@ -0,0 +1,2 @@ +out +target diff --git a/forc-pkg/tests/test_pkg_entry/Forc.lock b/forc-pkg/tests/test_pkg_entry/Forc.lock new file mode 100644 index 00000000000..a3db009892d --- /dev/null +++ b/forc-pkg/tests/test_pkg_entry/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-B2871353A775FFA4' + +[[package]] +name = 'std' +source = 'path+from-root-B2871353A775FFA4' +dependencies = ['core'] + +[[package]] +name = 'test_library' +source = 'member' +dependencies = ['std'] diff --git a/forc-pkg/tests/test_pkg_entry/Forc.toml b/forc-pkg/tests/test_pkg_entry/Forc.toml new file mode 100644 index 00000000000..01120788289 --- /dev/null +++ b/forc-pkg/tests/test_pkg_entry/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "lib.sw" +license = "Apache-2.0" +name = "test_pkg_entry" + +[dependencies] +std = { path = "../../../sway-lib-std/" } diff --git a/forc-pkg/tests/test_pkg_entry/src/lib.sw b/forc-pkg/tests/test_pkg_entry/src/lib.sw new file mode 100644 index 00000000000..2b48b1f0763 --- /dev/null +++ b/forc-pkg/tests/test_pkg_entry/src/lib.sw @@ -0,0 +1,8 @@ +library; + +#[test] +fn test_bum() { + let a = 10; + log(a); + assert(a == 10) +} From 90d31eb0851ac9e7eb3bc42e164e7de382ec73e6 Mon Sep 17 00:00:00 2001 From: Kaya Gokalp Date: Tue, 5 Mar 2024 15:53:14 -0800 Subject: [PATCH 3/5] chore: add more tests, and remove inlined function --- forc-pkg/src/pkg.rs | 117 +++++++++++++++-------- forc-pkg/tests/test_pkg_entry/Forc.lock | 16 ++-- forc-pkg/tests/test_pkg_entry/src/lib.sw | 60 +++++++++++- 3 files changed, 143 insertions(+), 50 deletions(-) diff --git a/forc-pkg/src/pkg.rs b/forc-pkg/src/pkg.rs index 73a81a22b19..cae0a92e456 100644 --- a/forc-pkg/src/pkg.rs +++ b/forc-pkg/src/pkg.rs @@ -31,7 +31,7 @@ use std::{ str::FromStr, sync::{atomic::AtomicBool, Arc}, }; -use sway_core::language::ty::{TyAstNodeContent, TyExpression, TyExpressionVariant}; +use sway_core::language::ty::{TyAstNodeContent, TyExpressionVariant}; pub use sway_core::Programs; use sway_core::TypeInfo; use sway_core::{ @@ -164,7 +164,7 @@ pub struct PkgTestEntry { pub pass_condition: TestPassCondition, pub span: Span, pub file_path: Arc, - pub log_params: Vec<(SourceId, Option>)>, + pub log_params: Vec<(SourceId, Arc)>, } /// The result of successfully compiling a workspace. @@ -2014,39 +2014,28 @@ impl PkgTestEntry { bail!("Invalid test argument(s) for test: {test_name}.") }?; - /// Given an AST node, checks: - /// - it is function, - /// - it is a log, - /// - /// If condition holds, returns type of log's param. - fn collect_log_type_from_decl( - expr: &TyExpression, - log_param_types: &mut Vec<(SourceId, Option>)>, - engines: &Engines, - ) { - if let TyExpressionVariant::FunctionApplication { - call_path, - arguments, - .. - } = &expr.expression - { - let suffix = call_path.suffix.to_string(); - if suffix == "log" { - let arg_type = arguments - .iter() - .map(|(_, arg_expr)| arg_expr.return_type) - .map(|type_id| engines.te().get(type_id)) - .next(); - log_param_types.push((expr.span.source_id().cloned().unwrap(), arg_type)); - } - } - } - let mut log_params = Vec::new(); for ast_node in test_function_decl.body.contents.iter() { if let TyAstNodeContent::Expression(expr) = &ast_node.content { - // We found an expression node, try to extract the arguments if this is an assert. - collect_log_type_from_decl(expr, &mut log_params, engines); + if let TyExpressionVariant::FunctionApplication { + call_path, + arguments, + .. + } = &expr.expression + { + let suffix = call_path.suffix.to_string(); + if suffix == "log" { + let arg_type = arguments + .iter() + .map(|(_, arg_expr)| arg_expr.return_type) + .map(|type_id| engines.te().get(type_id)) + .next(); + if let (Some(source_id), Some(arg_type)) = (expr.span.source_id(), arg_type) + { + log_params.push((*source_id, arg_type)); + } + } + } } } @@ -2057,7 +2046,6 @@ impl PkgTestEntry { ), ); - println!("{log_params:?}"); Ok(Self { pass_condition, span, @@ -2796,6 +2784,7 @@ pub fn fuel_core_not_running(node_url: &str) -> anyhow::Error { mod test { use super::*; use regex::Regex; + use sway_core::TypeArgument; use sway_types::integer_bits::IntegerBits; fn setup_build_plan(path: &str) -> BuildPlan { @@ -2814,8 +2803,7 @@ mod test { .unwrap() } - #[test] - fn test_collect_test_entry_logs() { + fn get_test_entry_logs(entry_name: &str) -> Vec> { let current_dir = env!("CARGO_MANIFEST_DIR"); let manifest_dir = format!("{current_dir}/tests/test_pkg_entry"); let build_opts = BuildOpts { @@ -2830,10 +2818,11 @@ mod test { }; let built_pkgs = build_with_options(build_opts).unwrap(); let built_pkg = built_pkgs.expect_pkg().unwrap(); - let test_entry = built_pkg + let pkg_entry = built_pkg .bytecode .entries .iter() + .filter(|pkg_entry| pkg_entry.finalized.fn_name == entry_name) .find_map(|entry| { if let PkgEntryKind::Test(test_entry) = &entry.kind { Some(test_entry) @@ -2843,20 +2832,66 @@ mod test { }) .unwrap(); - let log_params: Vec<_> = test_entry + pkg_entry .log_params .iter() .map(|(_, type_info)| type_info) - .collect(); - assert_eq!(log_params.len(), 1); - let type_info = log_params[0].clone().unwrap(); + .cloned() + .collect() + } + #[test] + fn collect_test_entry_log_unsigned_int() { + let log_types = get_test_entry_logs("log_unsigned_int"); + assert_eq!(log_types.len(), 1); assert!(matches!( - type_info.as_ref(), + *log_types[0], TypeInfo::UnsignedInteger(IntegerBits::SixtyFour) )) } + #[test] + fn collect_test_entry_log_bool() { + let log_types = get_test_entry_logs("log_bool"); + assert_eq!(log_types.len(), 1); + assert!(matches!(*log_types[0], TypeInfo::Boolean)) + } + + #[test] + fn collect_test_entry_log_string_slice() { + let log_types = get_test_entry_logs("log_string_slice"); + assert_eq!(log_types.len(), 1); + assert!(matches!(*log_types[0], TypeInfo::StringSlice)) + } + + #[test] + fn collect_test_entry_log_array() { + let log_types = get_test_entry_logs("log_array"); + assert_eq!(log_types.len(), 1); + assert!(matches!(*log_types[0], TypeInfo::Array(_, _))) + } + + #[test] + fn collect_test_entry_log_tuple() { + let log_types = get_test_entry_logs("log_tuple"); + assert_eq!(log_types.len(), 1); + assert!(matches!(*log_types[0], TypeInfo::Tuple(_))) + } + + #[test] + fn collect_test_entry_log_struct() { + let log_types = get_test_entry_logs("log_struct"); + assert_eq!(log_types.len(), 1); + assert!(matches!(*log_types[0], TypeInfo::Struct(_))) + } + + #[test] + fn collect_test_entry_log_enum() { + let log_types = get_test_entry_logs("log_enum"); + assert_eq!(log_types.len(), 1); + assert!(matches!(*log_types[0], TypeInfo::Enum(_))) + } + #[test] fn test_root_pkg_order() { let build_plan = setup_build_plan( diff --git a/forc-pkg/tests/test_pkg_entry/Forc.lock b/forc-pkg/tests/test_pkg_entry/Forc.lock index a3db009892d..d7cbba5ee34 100644 --- a/forc-pkg/tests/test_pkg_entry/Forc.lock +++ b/forc-pkg/tests/test_pkg_entry/Forc.lock @@ -1,13 +1,13 @@ [[package]] -name = 'core' -source = 'path+from-root-B2871353A775FFA4' +name = "core" +source = "path+from-root-9F43309F1982F720" [[package]] -name = 'std' -source = 'path+from-root-B2871353A775FFA4' -dependencies = ['core'] +name = "std" +source = "path+from-root-9F43309F1982F720" +dependencies = ["core"] [[package]] -name = 'test_library' -source = 'member' -dependencies = ['std'] +name = "test_pkg_entry" +source = "member" +dependencies = ["std"] diff --git a/forc-pkg/tests/test_pkg_entry/src/lib.sw b/forc-pkg/tests/test_pkg_entry/src/lib.sw index 2b48b1f0763..6c814e663aa 100644 --- a/forc-pkg/tests/test_pkg_entry/src/lib.sw +++ b/forc-pkg/tests/test_pkg_entry/src/lib.sw @@ -1,8 +1,66 @@ library; #[test] -fn test_bum() { +fn log_unsigned_int() { let a = 10; log(a); assert(a == 10) } + +#[test] +fn log_bool() { + let a = true; + log(a); + assert(a) +} + +#[test] +fn log_string_slice() { + let a = "test"; + log(a); + assert(a == "test") +} + +#[test] +fn log_array() { + let a: [u8; 5] = [1, 2, 3, 4, 5]; + log(a); + let b: [u8; 5] = [1, 2, 3, 4, 5]; + assert(a[0] == b[0]) +} + +#[test] +fn log_tuple() { + let a = (1,2); + log(a); + let b = (1,2); + assert(a.0 == b.0) +} + +struct Foo { + f1: u32, +} + +#[test] +fn log_struct() { + let a = Foo { + f1: 1, + }; + + log(a); + let b = Foo { + f1: 1, + }; + assert(a.f1 == b.f1) +} + + +enum Bar { + Foo: (), +} + +#[test] +fn log_enum() { + let a: Bar = Bar::Foo; + log(a); +} From e69bd15af45567166b687982d5eadff0e476b979 Mon Sep 17 00:00:00 2001 From: Kaya Gokalp Date: Tue, 5 Mar 2024 16:35:50 -0800 Subject: [PATCH 4/5] add multi test --- forc-pkg/src/pkg.rs | 20 ++++++++++++------ forc-pkg/tests/test_pkg_entry/src/lib.sw | 27 ++++++++++++++++++------ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/forc-pkg/src/pkg.rs b/forc-pkg/src/pkg.rs index cae0a92e456..1b6040e1df4 100644 --- a/forc-pkg/src/pkg.rs +++ b/forc-pkg/src/pkg.rs @@ -2784,8 +2784,6 @@ pub fn fuel_core_not_running(node_url: &str) -> anyhow::Error { mod test { use super::*; use regex::Regex; - use sway_core::TypeArgument; - use sway_types::integer_bits::IntegerBits; fn setup_build_plan(path: &str) -> BuildPlan { let current_dir = env!("CARGO_MANIFEST_DIR"); @@ -2844,10 +2842,7 @@ mod test { fn collect_test_entry_log_unsigned_int() { let log_types = get_test_entry_logs("log_unsigned_int"); assert_eq!(log_types.len(), 1); - assert!(matches!( - *log_types[0], - TypeInfo::UnsignedInteger(IntegerBits::SixtyFour) - )) + assert!(matches!(*log_types[0], TypeInfo::Numeric,)) } #[test] @@ -2892,6 +2887,19 @@ mod test { assert!(matches!(*log_types[0], TypeInfo::Enum(_))) } + #[test] + fn collect_test_entry_multiple_log() { + let log_types = get_test_entry_logs("log_multiple"); + assert_eq!(log_types.len(), 7); + assert!(matches!(*log_types[0], TypeInfo::Numeric)); + assert!(matches!(*log_types[1], TypeInfo::Boolean)); + assert!(matches!(*log_types[2], TypeInfo::StringSlice)); + assert!(matches!(*log_types[3], TypeInfo::Array(_, _))); + assert!(matches!(*log_types[4], TypeInfo::Tuple(_))); + assert!(matches!(*log_types[5], TypeInfo::Struct(_))); + assert!(matches!(*log_types[6], TypeInfo::Enum(_))); + } + #[test] fn test_root_pkg_order() { let build_plan = setup_build_plan( diff --git a/forc-pkg/tests/test_pkg_entry/src/lib.sw b/forc-pkg/tests/test_pkg_entry/src/lib.sw index 6c814e663aa..4d5996438a8 100644 --- a/forc-pkg/tests/test_pkg_entry/src/lib.sw +++ b/forc-pkg/tests/test_pkg_entry/src/lib.sw @@ -4,21 +4,18 @@ library; fn log_unsigned_int() { let a = 10; log(a); - assert(a == 10) } #[test] fn log_bool() { let a = true; log(a); - assert(a) } #[test] fn log_string_slice() { let a = "test"; log(a); - assert(a == "test") } #[test] @@ -26,7 +23,6 @@ fn log_array() { let a: [u8; 5] = [1, 2, 3, 4, 5]; log(a); let b: [u8; 5] = [1, 2, 3, 4, 5]; - assert(a[0] == b[0]) } #[test] @@ -34,7 +30,6 @@ fn log_tuple() { let a = (1,2); log(a); let b = (1,2); - assert(a.0 == b.0) } struct Foo { @@ -51,7 +46,6 @@ fn log_struct() { let b = Foo { f1: 1, }; - assert(a.f1 == b.f1) } @@ -64,3 +58,24 @@ fn log_enum() { let a: Bar = Bar::Foo; log(a); } + + +#[test] +fn log_multiple() { + let a = 10; + log(a); + let a = true; + log(a); + let a = "test"; + log(a); + let a: [u8; 5] = [1, 2, 3, 4, 5]; + log(a); + let a = (1,2); + log(a); + let a = Foo { + f1: 1, + }; + log(a); + let a: Bar = Bar::Foo; + log(a); +} From d47856e3ff8b342b966f436a969f810ff661de41 Mon Sep 17 00:00:00 2001 From: Kaya Gokalp Date: Tue, 5 Mar 2024 17:44:07 -0800 Subject: [PATCH 5/5] revert unnecessary changes to setup buildplan --- forc-pkg/src/pkg.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/forc-pkg/src/pkg.rs b/forc-pkg/src/pkg.rs index 1b6040e1df4..f8b264864f6 100644 --- a/forc-pkg/src/pkg.rs +++ b/forc-pkg/src/pkg.rs @@ -2785,9 +2785,12 @@ mod test { use super::*; use regex::Regex; - fn setup_build_plan(path: &str) -> BuildPlan { + fn setup_build_plan() -> BuildPlan { let current_dir = env!("CARGO_MANIFEST_DIR"); - let manifest_dir = PathBuf::from(current_dir).parent().unwrap().join(path); + let manifest_dir = PathBuf::from(current_dir) + .parent() + .unwrap() + .join("test/src/e2e_vm_tests/test_programs/should_pass/forc/workspace_building"); let manifest_file = ManifestFile::from_dir(manifest_dir).unwrap(); let member_manifests = manifest_file.member_manifests().unwrap(); let lock_path = manifest_file.lock_path().unwrap(); @@ -2902,9 +2905,7 @@ mod test { #[test] fn test_root_pkg_order() { - let build_plan = setup_build_plan( - "test/src/e2e_vm_tests/test_programs/should_pass/forc/workspace_building", - ); + let build_plan = setup_build_plan(); let graph = build_plan.graph(); let order: Vec = build_plan .member_nodes() @@ -2915,9 +2916,7 @@ mod test { #[test] fn test_visualize_with_url_prefix() { - let build_plan = setup_build_plan( - "test/src/e2e_vm_tests/test_programs/should_pass/forc/workspace_building", - ); + let build_plan = setup_build_plan(); let result = build_plan.visualize(Some("some-prefix::".to_string())); let re = Regex::new(r#"digraph \{ 0 \[ label = "test_contract" shape = box URL = "some-prefix::/[[:ascii:]]+/test_contract/Forc.toml"\] @@ -2933,9 +2932,7 @@ mod test { #[test] fn test_visualize_without_prefix() { - let build_plan = setup_build_plan( - "test/src/e2e_vm_tests/test_programs/should_pass/forc/workspace_building", - ); + let build_plan = setup_build_plan(); let result = build_plan.visualize(None); let expected = r#"digraph { 0 [ label = "test_contract" shape = box ]