History

Fix assertion in gix-url fixture test

Because `diag_url` contains the raw protocol string the assertion failed for `ssh+git`/`git+ssh` urls. The problem is that `scheme.as_str()` returns just `ssh` in those cases. By switching the conversion we can circumvent this behavior. Forget the above, I am stupid (currently amending this commit). The problem is that we do not parse `ssh+git`/`git+ssh` as SSH urls - there was nothing wrong with the previous version. Git uses an enum internally for different schemes and converts it to a string for the diagnose output. This is just one case where our parsing differs to the one from Git. Nevertheless, I keep the change, because it made the problem way clearer.

Niklas Wimmer committed 3 years ago

Commit ca421b71 parent 252dbb61 file · +4 −1Browse files

Unified · Split

gix-url/tests/fixture.rs+4−1
@@ -133,7 +133,10 @@ fn baseline() { · 132 unmodified lines
133133 }
134134
135135 fn assert_urls_equal(diag_url: &GitDiagUrl<'_>, gix_url: &gix_url::Url) {
136− assert_eq!(diag_url.protocol, gix_url.scheme.as_str());
136+ assert_eq!(
137+ gix_url::Scheme::from(diag_url.protocol.to_str().unwrap()),
138+ gix_url.scheme
139+ );
137140
138141 match diag_url.host {
139142 GitDiagHost::NonSsh { host_and_port } => match host_and_port {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t