diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 316e654..f9cd896 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,12 +37,21 @@ jobs: run: mix deps.get && mix deps.unlock --check-unused if: ${{ matrix.lint }} + - name: Check formatting + run: mix format --check-formatted + if: ${{ matrix.lint }} + - name: Compile with --warnings-as-errors run: mix compile --warnings-as-errors if: ${{ matrix.lint }} + - name: Run tests + run: mix test --warnings-as-errors + if: ${{ matrix.lint }} + - name: Run tests run: mix test + if: ${{ !matrix.lint }} test_older_elixir: runs-on: ubuntu-22.04 diff --git a/test/http_client_test.exs b/test/http_client_test.exs index d640f15..88476b0 100644 --- a/test/http_client_test.exs +++ b/test/http_client_test.exs @@ -1,6 +1,8 @@ defmodule Tzdata.HTTPClientTest do use ExUnit.Case, async: true + import ExUnit.CaptureLog + @url "https://data.iana.org/time-zones/tzdata-latest.tar.gz" test "Httpc client can HEAD the IANA tzdata URL over verified HTTPS, when it can verify certificates" do @@ -17,7 +19,19 @@ defmodule Tzdata.HTTPClientTest do end test "Hackney client can HEAD the IANA tzdata URL over verified HTTPS" do - assert {:ok, {200, headers}} = Tzdata.HTTPClient.Hackney.head(@url, [], []) + # Hackney support is deprecated: call it via `apply/3` so the compiler's + # static `@deprecated` check doesn't fire, and capture the runtime + # deprecation log it emits, since triggering both here is expected. + # `capture_log/2` (rather than `with_log/1`, added in Elixir 1.13) keeps + # this working on the oldest Elixir version this library supports. + log = + capture_log(fn -> + send(self(), {:head_result, apply(Tzdata.HTTPClient.Hackney, :head, [@url, [], []])}) + end) + + assert_received {:head_result, result} + assert {:ok, {200, headers}} = result assert Enum.any?(headers, fn {k, _v} -> String.downcase(k) == "content-length" end) + assert log =~ "Hackney" end end