Repository: xd009642/tarpaulin
Pull request #1452 (2024-01-08 03:39:36)

Bump serde from 1.0.194 to 1.0.195
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.194 to 1.0.195.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p>
<blockquote>
<h2>v1.0.195</h2>
<ul>
<li>Prevent remote definitions of tuple struct or tuple variant from triggering dead_code warning (<a href="https://redirect.github.com/serde-rs/serde/issues/2671">#2671</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/serde-rs/serde/commit/03eec42c3313b36da416be1486e9ecac345784d5"><code>03eec42</code></a> Release 1.0.195</li>
<li><a href="https://github.com/serde-rs/serde/commit/196f311ae2fd8ad94fe38a57830419859a4d3dbb"><code>196f311</code></a> Merge pull request <a href="https://redirect.github.com/serde-rs/serde/issues/2671">#2671</a> from dtolnay/deadremote</li>
<li><a href="https://github.com/serde-rs/serde/commit/38d9e0b2091e9b6150486c2c37367819b86bcc39"><code>38d9e0b</code></a> Revert &quot;Add FIXME to fix dead_code warning when using serde(remote)&quot;</li>
<li><a href="https://github.com/serde-rs/serde/commit/6502b3131697eff6420786ad71f87f29cfff3a13"><code>6502b31</code></a> Fix new dead_code warning in tuple struct and tuple variant remote defs</li>
<li><a href="https://github.com/serde-rs/serde/commit/6f1a8c3115c8d2502178c25d610fbaee2e82c46b"><code>6f1a8c3</code></a> Add FIXME to fix dead_code warning when using serde(remote)</li>
<li><a href="https://github.com/serde-rs/serde/commit/d883c94cc9fe72d0512dc7f4def7191a401595c9"><code>d883c94</code></a> Work around dead_code warning in tests</li>
<li><a href="https://github.com/serde-rs/serde/commit/961fa59a7469c5b5e323b9723323df412048d60d"><code>961fa59</code></a> Merge pull request <a href="https://redirect.github.com/serde-rs/serde/issues/2670">#2670</a> from serde-rs/exhaustive</li>
<li><a href="https://github.com/serde-rs/serde/commit/8bc71def551df190e6817d3311e5c76f751f53e6"><code>8bc71de</code></a> Fill in omitted patterns for GenericArguments match</li>
<li><a href="https://github.com/serde-rs/serde/commit/7c65a9dc0eab2d4d829b258a7b3549351bbe8dcd"><code>7c65a9d</code></a> Pick up changes to non_exhaustive_omitted_patterns lint</li>
<li>See full diff in <a href="https://github.com/serde-rs/serde/compare/v1.0.194...v1.0.195">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.194&new-version=1.0.195)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 20ec24a..f29c489 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1411,18 +1411,18 @@ dependencies = [
 
 [[package]]
 name = "serde"
-version = "1.0.194"
+version = "1.0.195"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773"
+checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
 dependencies = [
  "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.194"
+version = "1.0.195"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0"
+checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
 dependencies = [
  "proc-macro2",
  "quote",
diff --git a/README.md b/README.md
index 047bafb..bf41e63 100644
--- a/README.md
+++ b/README.md
@@ -505,7 +505,7 @@ job: ...
 
 and generate a `cobertura.xml` as described under [Pycobertura](#pycobertura).
 
-  [show coverage information]: https://docs.gitlab.com/ee/user/project/merge_requests/test_coverage_visualization.html
+  [show coverage information]: https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html
 
 For installation add `cargo install cargo-tarpaulin -f` to the script section.
 
diff --git a/src/report/coveralls.rs b/src/report/coveralls.rs
index e10de24..2571ead 100644
--- a/src/report/coveralls.rs
+++ b/src/report/coveralls.rs
@@ -4,7 +4,7 @@ use crate::traces::{CoverageStat, TraceMap};
 use coveralls_api::*;
 use std::collections::HashMap;
 use std::fs;
-use std::path::Path;
+use std::path::{Path, PathBuf};
 use tracing::{info, trace, warn};
 
 fn get_git_info(manifest_path: &Path) -> Result<GitInfo, String> {
@@ -84,7 +84,7 @@ pub fn export(coverage_data: &TraceMap, config: &Config) -> Result<(), RunError>
 
         let mut report = CoverallsReport::new(id);
         for file in &coverage_data.files() {
-            let rel_path = config.strip_base_dir(file);
+            let rel_path = get_rel_path(config, file);
             let mut lines: HashMap<usize, usize> = HashMap::new();
             let fcov = coverage_data.get_child_traces(file);
 
@@ -143,10 +143,24 @@ pub fn export(coverage_data: &TraceMap, config: &Config) -> Result<(), RunError>
     }
 }
 
+fn get_rel_path(config: &Config, file: &&PathBuf) -> PathBuf {
+    if cfg!(windows) {
+        let rel_path_with_windows_path_separator = config.strip_base_dir(file);
+        let rel_path_with_windows_path_separator_as_str =
+            String::from(rel_path_with_windows_path_separator.to_str().unwrap());
+        let rel_path_with_linux_path_separator =
+            rel_path_with_windows_path_separator_as_str.replace("\\", "/");
+
+        PathBuf::from(rel_path_with_linux_path_separator)
+    } else {
+        config.strip_base_dir(file)
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;
-    use std::process::Command;
+    use std::{path::PathBuf, process::Command};
 
     #[test]
     fn git_info_correct() {
@@ -177,4 +191,24 @@ mod tests {
 
         assert_eq!(output, expected);
     }
+
+    #[test]
+    #[cfg_attr(target_family = "windows", ignore)]
+    fn get_rel_path_coveralls_friendly_on_linux() {
+        let config = Config::default();
+        let file = PathBuf::from("src/report/coveralls.rs");
+        let rel_path = get_rel_path(&config, &&file);
+
+        assert_eq!(rel_path, PathBuf::from("src/report/coveralls.rs"));
+    }
+
+    #[test]
+    #[cfg_attr(not(target_family = "windows"), ignore)]
+    fn get_rel_path_coveralls_friendly_on_windows() {
+        let config = Config::default();
+        let file = PathBuf::from("src\\report\\coveralls.rs");
+        let rel_path = get_rel_path(&config, &&file);
+
+        assert_eq!(rel_path, PathBuf::from("src/report/coveralls.rs"));
+    }
 }


Test patch:
diff --git a/tests/mod.rs b/tests/mod.rs
index a176ac7..156d7b2 100755
--- a/tests/mod.rs
+++ b/tests/mod.rs
@@ -241,6 +241,7 @@ fn method_calls_expr_coverage() {
 }
 
 #[test]
+#[cfg(not(windows))] // TODO fix
 fn config_file_coverage() {
     let test_dir = get_test_path("configs");
     let mut args = vec![
@@ -305,6 +306,7 @@ fn cargo_run_coverage() {
 }
 
 #[test]
+#[cfg(not(windows))] // TODO fix
 fn examples_coverage() {
     let test = "example_test";
     check_percentage(test, 0.0f64, true);