Skip to content

Commit 30e3834

Browse files
🧪 test: implement missing tests for SubmoduleEntry::is_remote (#42)
- Updated `test_entry_is_remote` in `src/config.rs` with additional edge cases: - Verifying that a protocol not at the start of the URL string returns false. - Verifying that a minimal protocol string (e.g., "https://") returns true. - Added `test_config_submodule_remote_check` to `src/config.rs` to verify remote status on entries added to a `Config` struct. Addresses the missing testing gap for `is_remote` as specified in the task. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent f1994e2 commit 30e3834

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎src/config.rs‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,14 @@ mod tests {
12591259

12601260
entry.url = None;
12611261
assert!(!entry.is_remote());
1262+
1263+
// Protocol not at start
1264+
entry.url = Some("/path/to/https://repo".to_string());
1265+
assert!(!entry.is_remote());
1266+
1267+
// Minimal protocol
1268+
entry.url = Some("https://".to_string());
1269+
assert!(entry.is_remote());
12621270
}
12631271

12641272
#[test]
@@ -2110,4 +2118,24 @@ active = true
21102118
let data = config.data();
21112119
assert!(data.is_ok());
21122120
}
2121+
2122+
#[test]
2123+
fn test_config_submodule_remote_check() {
2124+
let mut config = Config::default();
2125+
let entry = SubmoduleEntry::new(
2126+
Some("https://github.com/user/repo".to_string()),
2127+
Some("libs/repo".to_string()),
2128+
None,
2129+
None,
2130+
None,
2131+
None,
2132+
Some(true),
2133+
None,
2134+
None,
2135+
);
2136+
config.add_submodule("repo".to_string(), entry);
2137+
2138+
let retrieved = config.get_submodule("repo").expect("submodule should exist");
2139+
assert!(retrieved.is_remote());
2140+
}
21132141
}

0 commit comments

Comments
 (0)