Skip to content

Commit

Permalink
Fix new docs clippies in tests (#2302)
Browse files Browse the repository at this point in the history
* Fix new docs clippies in tests

* Disable wasm tests
  • Loading branch information
andrewdavidmackenzie authored Sep 12, 2024
1 parent 289d27b commit 0d32b94
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 24 deletions.
34 changes: 18 additions & 16 deletions flowc/tests/flowc-compiler_tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(missing_docs)]

#[cfg(feature = "debugger")]
use std::collections::BTreeMap;

Expand Down Expand Up @@ -36,7 +38,7 @@ mod helper;
#[test]
fn object_to_array_connection() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path(
"flowc/tests/test-flows/object_to_array_connection/root.toml",
Expand All @@ -47,7 +49,7 @@ fn object_to_array_connection() {
let output_dir = tempdir().expect("A temp dir").into_path();

#[cfg(feature = "debugger")]
let mut source_urls = BTreeMap::<String, Url>::new();
let mut source_urls = BTreeMap::<String, Url>::new();

let _tables = compile::compile(flow, &output_dir, false, false, &mut source_urls)
.expect("Could not compile flow");
Expand All @@ -59,7 +61,7 @@ fn object_to_array_connection() {
#[test]
fn context_with_io() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path(
"flowc/tests/test-flows/context_with_io/root.toml",
Expand All @@ -85,7 +87,7 @@ fn context_with_io() {
#[test]
fn same_name_input_and_output() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path(
"flowc/tests/test-flows/same-name-parent/root.toml",
Expand All @@ -110,7 +112,7 @@ fn same_name_input_and_output() {
#[test]
fn same_name_flow_ids() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path(
"flowc/tests/test-flows/same-name-parent/root.toml",
Expand Down Expand Up @@ -145,7 +147,7 @@ fn same_name_flow_ids() {
#[test]
fn connection_to_input_with_constant_initializer() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path(
"flowc/tests/test-flows/connect_to_constant/root.toml",
Expand All @@ -159,7 +161,7 @@ fn connection_to_input_with_constant_initializer() {
let mut source_urls = BTreeMap::<String, Url>::new();

assert!(compile::compile(flow, &output_dir, false, false, &mut source_urls).is_err(),
"Process should not have loaded due to connection to input with a constant initializer");
"Process should not have loaded due to connection to input with a constant initializer");
} else {
panic!("Process loaded was not a flow");
}
Expand All @@ -168,7 +170,7 @@ fn connection_to_input_with_constant_initializer() {
#[test]
fn args() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path =
helper::absolute_file_url_from_relative_path("flowc/tests/test-flows/args/root.toml");
Expand All @@ -190,7 +192,7 @@ fn args() {
#[test]
fn no_side_effects() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path("flowc/tests/test-flows/no_side_effects/root.toml");
let process = parser::parse(&path, &meta_provider)
Expand All @@ -215,7 +217,7 @@ fn no_side_effects() {
#[test]
fn compile_echo_ok() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let process = parser::parse(
&helper::absolute_file_url_from_relative_path("flowc/tests/test-flows/echo/root.toml"),
Expand All @@ -236,7 +238,7 @@ fn compile_echo_ok() {
#[test]
fn compiler_detects_unused_input() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let process = parser::parse(
&helper::absolute_file_url_from_relative_path(
Expand Down Expand Up @@ -266,7 +268,7 @@ fn compiler_detects_unused_input() {
#[test]
fn flow_input_propagated_back_out() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
// Relative path from project root to the test file
let url = helper::absolute_file_url_from_relative_path(
Expand All @@ -285,7 +287,7 @@ fn flow_input_propagated_back_out() {
Ok(_tables) => {}
Err(error) => panic!("Couldn't compile the flow from test file at '{url}'\n{error}"),
}
},
}
Ok(FunctionProcess(_)) => panic!("Unexpected compile result from test file at '{url}'"),
Err(error) => panic!("Couldn't parse the flow from test file at '{url}'.\n{error}"),
}
Expand All @@ -297,7 +299,7 @@ fn flow_input_propagated_back_out() {
#[test]
fn initialized_output_propagated() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
// Relative path from project root to the test file
let url = helper::absolute_file_url_from_relative_path(
Expand Down Expand Up @@ -348,7 +350,7 @@ fn initialized_output_propagated() {
#[test]
fn initialized_input_to_subflow() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
// Relative path from project root to the test file
let url = helper::absolute_file_url_from_relative_path(
Expand Down Expand Up @@ -397,7 +399,7 @@ fn initialized_input_to_subflow() {
fn json_indexing() {
let meta_provider = MetaProvider::new(
helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path =
helper::absolute_file_url_from_relative_path("flowc/tests/test-flows/json-indexing/root.toml");
Expand Down
16 changes: 9 additions & 7 deletions flowc/tests/flowc-parser_tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(missing_docs)]

use flowcore::meta_provider::MetaProvider;
use flowcore::model::input::InputInitializer::{Always, Once};
use flowcore::model::io::IO;
Expand Down Expand Up @@ -29,7 +31,7 @@ mod helper;
#[test]
fn malformed_connection() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path(
"flowc/tests/test-flows/malformed-connection/root.toml",
Expand All @@ -45,7 +47,7 @@ fn malformed_connection() {
#[test]
fn aliased_context_not_allowed() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path(
"flowc/tests/test-flows/aliased_context/root.toml",
Expand All @@ -61,7 +63,7 @@ fn aliased_context_not_allowed() {
#[test]
fn invalid_toml() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path("flowc/tests/test-flows/invalid/root.toml");
match parser::parse(&path, &meta_provider) {
Expand All @@ -73,7 +75,7 @@ fn invalid_toml() {
#[test]
fn no_connections() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path(
"flowc/tests/test-flows/no-connections/root.toml",
Expand All @@ -87,7 +89,7 @@ fn no_connections() {
#[test]
fn function_input_initialized() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let url = helper::absolute_file_url_from_relative_path(
"flowc/tests/test-flows/function_input_init/root.toml",
Expand Down Expand Up @@ -119,7 +121,7 @@ fn function_input_initialized() {
#[test]
fn root_flow_takes_name_from_file() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
// Relative path from project root to the test file
let url =
Expand All @@ -134,7 +136,7 @@ fn root_flow_takes_name_from_file() {
#[test]
fn load_library() {
let meta_provider = MetaProvider::new(helper::set_lib_search_path_to_project(),
helper::get_canonical_context_root()
helper::get_canonical_context_root(),
);
let path = helper::absolute_file_url_from_relative_path("flowc/tests/test_libs/Cargo.toml");
parser::parse_metadata(&path, &meta_provider).expect("Could not load metadata");
Expand Down
2 changes: 2 additions & 0 deletions flowc/tests/helper.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(missing_docs)]

use std::env;
use std::path::Path;
use std::path::PathBuf;
Expand Down
1 change: 1 addition & 0 deletions flowr/examples/mandlebrot/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod test {
use std::path::PathBuf;

#[test]
#[ignore]
fn test_mandlebrot_example() {
let _ = env::set_current_dir(PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent().expect("Could not cd into flow directory"));
Expand Down
1 change: 1 addition & 0 deletions flowr/examples/reverse-echo/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod test {
use std::path::PathBuf;

#[test]
#[ignore]
fn test_reverse_echo_example() {
let _ = env::set_current_dir(PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent().expect("Could not cd into flow directory"));
Expand Down
4 changes: 3 additions & 1 deletion flowr/tests/client_server.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#![allow(missing_docs)]

use std::path::PathBuf;

#[test]
fn hello_world_client_server() {
let example_dir = PathBuf::from("examples/hello-world");
utilities::compile_example(&example_dir,"flowrcli");
utilities::compile_example(&example_dir, "flowrcli");
utilities::execute_flow_client_server("hello-world", example_dir.join("manifest.json"));
}
2 changes: 2 additions & 0 deletions flowr/tests/flowrex.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(missing_docs)]

#[test]
fn test_fibonacci_flowrex_example() {
utilities::test_example("flowr/examples/hello-world/main.rs", "flowrcli", true, true);
Expand Down
2 changes: 2 additions & 0 deletions flowr/tests/flowrgui.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(missing_docs)]

#[test]
fn test_fibonacci_flowrgui_example() {
utilities::run_example("examples/fibonacci/main.rs", "flowrgui", false, true);
Expand Down
3 changes: 3 additions & 0 deletions flowr/tests/wasm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#![allow(missing_docs)]

#[test]
#[ignore]
fn test_fibonacci_wasm_example() {
utilities::test_example("flowr/examples/fibonacci/main.rs",
"flowrcli", false, false);
Expand Down
1 change: 1 addition & 0 deletions flowstdlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub mod errors;

#[cfg(test)]
#[allow(clippy::missing_panics_doc)]
#[allow(missing_docs)]
pub mod test {
use std::io::Read;
use std::path::Path;
Expand Down

0 comments on commit 0d32b94

Please sign in to comment.