From 26120fba1fdf0aa77e8f2856d304813a8112e973 Mon Sep 17 00:00:00 2001 From: Juan Peri Date: Wed, 4 Sep 2024 08:06:17 +0200 Subject: [PATCH] Update Range to use function syntax (#332) * add missing step for Cobertura's range * Update Range to use function syntax * run tests in elixir 1.17 * fix test with relative path --------- Co-authored-by: parroty --- .github/workflows/tests.yml | 2 ++ lib/excoveralls/cobertura.ex | 2 +- test/settings_test.exs | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 539d207a..9123df3a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,6 +13,8 @@ jobs: elixir: '1.11' - otp: '26.0' elixir: '1.15' + - otp: '27.0' + elixir: '1.17' env: MIX_ENV: test GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/lib/excoveralls/cobertura.ex b/lib/excoveralls/cobertura.ex index 9e43540d..dd58bd2e 100644 --- a/lib/excoveralls/cobertura.ex +++ b/lib/excoveralls/cobertura.ex @@ -188,7 +188,7 @@ defmodule ExCoveralls.Cobertura do # We use Range.new/3 because using x..y//step would give a syntax error on Elixir < 1.12 defp get_slice_range_for_package_name(c_path), do: Range.new(String.length(c_path) + 1, -1, 1) else - defp get_slice_range_for_package_name(c_path), do: (String.length(c_path) + 1)..-1 + defp get_slice_range_for_package_name(c_path), do: Range.new(String.length(c_path) + 1, -1) end defp rate(valid_lines) when length(valid_lines) == 0, do: 0.0 diff --git a/test/settings_test.exs b/test/settings_test.exs index 07c3197c..66e5869f 100644 --- a/test/settings_test.exs +++ b/test/settings_test.exs @@ -15,7 +15,8 @@ defmodule Excoveralls.SettingsTest do test "returns default file path" do assert(Settings.Files.default_file - |> Path.relative_to(File.cwd!) == "lib/excoveralls/../conf/coveralls.json") + |> Path.expand() + |> Path.relative_to(File.cwd!) == "lib/conf/coveralls.json") end test "returns custom file path" do