Skip to content

Commit

Permalink
Update Range to use function syntax (#332)
Browse files Browse the repository at this point in the history
* 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 <parroty@users.noreply.github.com>
  • Loading branch information
juanperi and parroty authored Sep 4, 2024
1 parent d0d8891 commit 26120fb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion lib/excoveralls/cobertura.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/settings_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26120fb

Please sign in to comment.