-
Notifications
You must be signed in to change notification settings - Fork 0
Increase coverage #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,20 @@ | ||
| #![cfg(test)] | ||
|
|
||
| use et_path::find_project_root; | ||
| use et_path::{find_project_root, find_project_root_from_manifest}; | ||
| use fs_err as fs; | ||
| use tempfile::tempdir; | ||
|
|
||
| #[test] | ||
| fn manifest_dir_resolves_to_an_existing_root() { | ||
| // cargo sets `CARGO_MANIFEST_DIR` in the test process env, so the helper reads this crate's | ||
| // directory and walks up to the workspace root (which carries project-root markers). | ||
| let root = find_project_root_from_manifest(); | ||
| assert!( | ||
| root.is_dir(), | ||
| "resolved project root {root:?} should be an existing directory" | ||
| ); | ||
|
Comment on lines
+11
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Assert that the resolved path is the project root, not merely a directory.
🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| #[test] | ||
| fn finds_marker_in_an_ancestor() { | ||
| let root = tempdir().unwrap(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -133,7 +133,7 @@ fn handle_incoming_message( | |||||
| "comm1: received {scope:?} message {message_id} from {from_agent_id} at {server_received_at}: {summary}" | ||||||
| ); | ||||||
| web_sys::console::log_1(&JsValue::from_str(&line)); | ||||||
| drop(set_module_status(&line)); | ||||||
| let _status = set_module_status(&line); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MEDIUM RISK Suggestion: Use the newly introduced 'et_web::ignore' utility here instead of 'let _status'. This ensures consistency with other browser-based WASM modules updated in this PR and adheres to the project's workspace-wide linting strategy for 'must_use' results.
Suggested change
|
||||||
| } | ||||||
| ServerMessage::MessageStatus { | ||||||
| message_id, | ||||||
|
|
@@ -142,12 +142,12 @@ fn handle_incoming_message( | |||||
| } => { | ||||||
| let line = format!("comm1: message status update {message_id:?} {status:?}: {detail}"); | ||||||
| web_sys::console::log_1(&JsValue::from_str(&line)); | ||||||
| drop(set_module_status(&line)); | ||||||
| let _status = set_module_status(&line); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ LOW RISK Suggestion: Use 'et_web::ignore' for consistency with other browser-based WASM modules in this PR to discard the result of 'set_module_status'. |
||||||
| } | ||||||
| ServerMessage::Invalid { message_id, detail } => { | ||||||
| let line = format!("comm1: invalid server response {message_id:?}: {detail}"); | ||||||
| web_sys::console::warn_1(&JsValue::from_str(&line)); | ||||||
| drop(set_module_status(&line)); | ||||||
| let _status = set_module_status(&line); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ LOW RISK Suggestion: Use 'et_web::ignore' for consistency with other browser-based WASM modules in this PR to discard the result of 'set_module_status'. |
||||||
| } | ||||||
| ServerMessage::ConnectAck { .. } | ||||||
| | ServerMessage::Response { .. } | ||||||
|
|
@@ -192,13 +192,13 @@ async fn sleep_ms(duration_ms: i32) -> Result<(), JsValue> { | |||||
| let window = web_sys::window().ok_or_else(|| JsValue::from_str("No window available"))?; | ||||||
| let promise = Promise::new(&mut |resolve, reject| { | ||||||
| let callback = Closure::once_into_js(move || { | ||||||
| drop(resolve.call0(&JsValue::NULL)); | ||||||
| let _resolved = resolve.call0(&JsValue::NULL); | ||||||
| }); | ||||||
|
|
||||||
| if let Err(error) = | ||||||
| window.set_timeout_with_callback_and_timeout_and_arguments_0(callback.unchecked_ref(), duration_ms) | ||||||
| { | ||||||
| drop(reject.call1(&JsValue::NULL, &error)); | ||||||
| let _rejected = reject.call1(&JsValue::NULL, &error); | ||||||
| } | ||||||
| }); | ||||||
| JsFuture::from(promise).await.map(|_| ()) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,7 @@ pub async fn run() -> Result<(), JsValue> { | |
| let Some(data) = value.as_string() else { | ||
| return; | ||
| }; | ||
| drop(serde_json::from_str::<ServerMessage>(&data)); | ||
| et_web::ignore(serde_json::from_str::<ServerMessage>(&data)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MEDIUM RISK The call to 'serde_json::from_str' currently has no effect as the result is discarded. Remove this call if validation is not needed, or update it to log a warning (e.g., using 'tracing::warn!') if parsing fails to avoid silent diagnostic gaps. |
||
| }) as Box<dyn FnMut(JsValue)>); | ||
|
|
||
| client.set_on_message(on_message.as_ref().clone()); | ||
|
|
@@ -134,7 +134,7 @@ async fn sleep_ms(duration_ms: i32) -> Result<(), JsValue> { | |
| let window = web_sys::window().ok_or_else(|| JsValue::from_str("No window available"))?; | ||
| let promise = Promise::new(&mut |resolve, _reject| { | ||
| let callback = Closure::once_into_js(move || { | ||
| drop(resolve.call0(&JsValue::NULL)); | ||
| et_web::ignore(resolve.call0(&JsValue::NULL)); | ||
| }); | ||
| let _id: Result<i32, JsValue> = | ||
| window.set_timeout_with_callback_and_timeout_and_arguments_0(callback.unchecked_ref(), duration_ms); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 HIGH RISK
Invoke the utilities directly (e.g., 'dirname', 'uname') instead of prefixing them with 'coreutils' to ensure compatibility across standard shell environments.