Skip to content

Commit 43a1b65

Browse files
committed
Fix warnings for Elixir 1.17
1 parent bb4c5b6 commit 43a1b65

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
**Cldr Utils from version 2.18.0 requires Elixir 1.11 or later**
44

5+
## Cldr Utils version 2.26.0
6+
7+
This is the changelog for Cldr Utils v2.25.0 released on March 20th, 2024. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_utils/tags)
8+
9+
### Bug Fixes
10+
11+
* Fix warnings on Elixir 1.17. This primarily relates to charlists constants now required to use `sigil_c` to avoid warnings. As a result, tests will only work on Elixir 1.16 and later even though support for the library is for Elixir 1.11 and later.
12+
513
## Cldr Utils version 2.25.0
614

715
This is the changelog for Cldr Utils v2.25.0 released on March 20th, 2024. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_utils/tags)

lib/cldr/utils/digits.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ defmodule Cldr.Digits do
100100
iex> Cldr.Digits.number_of_digits(1234.56789098765)
101101
15
102102
103-
iex> Cldr.Digits.number_of_digits '12345'
103+
iex> Cldr.Digits.number_of_digits(~c"12345")
104104
5
105105
106106
"""
@@ -151,7 +151,7 @@ defmodule Cldr.Digits do
151151
iex> Cldr.Digits.number_of_integer_digits(1234.456)
152152
4
153153
154-
iex> Cldr.Digits.number_of_integer_digits '12345'
154+
iex> Cldr.Digits.number_of_integer_digits(~c"12345")
155155
5
156156
157157
"""

lib/cldr/utils/math.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ defmodule Cldr.Math do
250250

251251
# When checking if a decimal is in a range it is only
252252
# valid if there are no decimal places
253-
def within(number, first..last) when is_float(number) do
253+
def within(number, %{first: first, last: last}) when is_float(number) do
254254
number == trunc(number) && number >= first && number <= last
255255
end
256256

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Cldr.Utils.MixProject do
22
use Mix.Project
33

4-
@version "2.25.0"
4+
@version "2.26.0-dev"
55
@source_url "https://github.com/elixir-cldr/cldr_utils"
66

77
def project do

test/http_test.exs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ defmodule Cldr.Http.Test do
22
use ExUnit.Case
33
import ExUnit.CaptureLog
44

5+
@accept_language String.to_charlist("Accept-Language")
6+
@any String.to_charlist("*")
7+
58
test "Downloading an https url" do
69
assert {:ok, _body} = Cldr.Http.get("https://google.com")
710
end
@@ -17,15 +20,15 @@ defmodule Cldr.Http.Test do
1720
end
1821

1922
test "Request with headers" do
20-
assert {:ok, _body} = Cldr.Http.get({"https://google.com", [{'Accept-Language', '*'}]})
23+
assert {:ok, _body} = Cldr.Http.get({"https://google.com", [{@accept_language, @any}]})
2124
end
2225

2326
test "Request with headers and no peer verification" do
24-
assert {:ok, _body} = Cldr.Http.get({"https://google.com", [{'Accept-Language', '*'}]}, verify_peer: false)
27+
assert {:ok, _body} = Cldr.Http.get({"https://google.com", [{@accept_language, @any}]}, verify_peer: false)
2528
end
2629

2730
test "Request with headers returning headers" do
28-
assert {:ok, _headers, _body} = Cldr.Http.get_with_headers({"https://google.com", [{'Accept-Language', '*'}]})
31+
assert {:ok, _headers, _body} = Cldr.Http.get_with_headers({"https://google.com", [{@accept_language, @any}]})
2932
end
3033

3134
if Version.compare(System.version(), "1.14.9") == :gt do
@@ -34,7 +37,7 @@ defmodule Cldr.Http.Test do
3437

3538
assert capture_log(fn ->
3639
assert {:error, :connection_timeout} =
37-
Cldr.Http.get_with_headers({"https://google.com", [{'Accept-Language', '*'}]}, options)
40+
Cldr.Http.get_with_headers({"https://google.com", [{@accept_language, @any}]}, options)
3841
end) =~ "Timeout connecting to ~c\"google.com\""
3942
end
4043

@@ -43,7 +46,7 @@ defmodule Cldr.Http.Test do
4346

4447
assert capture_log(fn ->
4548
assert {:error, :timeout} =
46-
Cldr.Http.get_with_headers({"https://google.com", [{'Accept-Language', '*'}]}, options)
49+
Cldr.Http.get_with_headers({"https://google.com", [{@accept_language, @any}]}, options)
4750
end) =~ "Timeout downloading from ~c\"https://google.com\". Request exceeded #{inspect options[:timeout]}ms."
4851
end
4952
end

0 commit comments

Comments
 (0)