From 169f434d4617fc6f551f4f0506eab2563d35adae Mon Sep 17 00:00:00 2001 From: Matt Nowack Date: Tue, 3 Jun 2025 16:52:16 -0400 Subject: [PATCH 1/7] Fixes missed export bug. When the same function is exported with multiple arities in multiple different export attributes the old code would merge them so only the last arity would be kept --- lib/patch/mock/code/queries/exports.ex | 3 ++- .../patch/mock/code/queries/exports_test.exs | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 test/unit/patch/mock/code/queries/exports_test.exs diff --git a/lib/patch/mock/code/queries/exports.ex b/lib/patch/mock/code/queries/exports.ex index 8c8dd40..51e48ff 100644 --- a/lib/patch/mock/code/queries/exports.ex +++ b/lib/patch/mock/code/queries/exports.ex @@ -9,7 +9,8 @@ defmodule Patch.Mock.Code.Queries.Exports do abstract_forms |> Enum.filter(&match?({:attribute, _, :export, _}, &1)) |> Enum.reduce([], fn {_, _, _, exports}, acc -> - Keyword.merge(acc, exports) + [exports | acc] end) + |> List.flatten() end end diff --git a/test/unit/patch/mock/code/queries/exports_test.exs b/test/unit/patch/mock/code/queries/exports_test.exs new file mode 100644 index 0000000..bb1fb9f --- /dev/null +++ b/test/unit/patch/mock/code/queries/exports_test.exs @@ -0,0 +1,23 @@ +defmodule Patch.Test.Unit.Patch.Mock.Code.Queries.ExportsTest do + use ExUnit.Case + + alias Patch.Mock.Code.Queries.Exports + + describe "query/1" do + test "handles functions with multiple arities declared across multiple exports" do + forms = [ + {:attribute, 1, :export, [a: 1]}, + {:attribute, 1, :export, [a: 2]} + ] + + expected = Enum.sort([a: 1, a: 2]) + + actual = + forms + |> Exports.query() + |> Enum.sort() + + assert expected == actual + end + end +end From f77ca6022dece49deb29bc85ade7548f1f2797c8 Mon Sep 17 00:00:00 2001 From: Matt Nowack Date: Tue, 3 Jun 2025 16:56:23 -0400 Subject: [PATCH 2/7] Update the runner --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74c7fa9..f81e0d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: jobs: build: name: Build and test - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 strategy: matrix: include: From 6de8a63cc2d675d83825ee7cd4933ac21f41e9db Mon Sep 17 00:00:00 2001 From: Matt Nowack Date: Tue, 3 Jun 2025 16:57:26 -0400 Subject: [PATCH 3/7] try 22.04 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f81e0d0..03eb6bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: jobs: build: name: Build and test - runs-on: ubuntu-24.04 + runs-on: ubuntu-22.04 strategy: matrix: include: From 1a69ed2bd6d8cace9f968399484498928dd386a4 Mon Sep 17 00:00:00 2001 From: Matt Nowack Date: Tue, 3 Jun 2025 16:58:54 -0400 Subject: [PATCH 4/7] actually use ubuntu-latest --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03eb6bb..604a848 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: jobs: build: name: Build and test - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: matrix: include: @@ -77,7 +77,6 @@ jobs: otp-version: 26.2 - elixir-version: 1.18.1 otp-version: 27.2 - steps: - uses: actions/checkout@v3 - name: Set up Elixir From 7295a609fb59fa1a3707803f734b1493e319e4a1 Mon Sep 17 00:00:00 2001 From: Matt Nowack Date: Tue, 3 Jun 2025 17:04:23 -0400 Subject: [PATCH 5/7] Update ci --- .github/workflows/ci.yml | 38 ++++++-------------------------------- README.md | 17 +++++++---------- 2 files changed, 13 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 604a848..453e5f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,42 +13,14 @@ jobs: strategy: matrix: include: - - elixir-version: 1.9.4 - otp-version: 20.3 - - elixir-version: 1.9.4 - otp-version: 21.3 - - elixir-version: 1.9.4 - otp-version: 22.3 - - elixir-version: 1.10.4 - otp-version: 21.3 - - elixir-version: 1.10.4 - otp-version: 22.3 - - elixir-version: 1.10.4 - otp-version: 23.3 - - elixir-version: 1.11.4 - otp-version: 21.3 - - elixir-version: 1.11.4 - otp-version: 22.3 - - elixir-version: 1.11.4 - otp-version: 23.3 - elixir-version: 1.11.4 otp-version: 24.3 - - elixir-version: 1.12.3 - otp-version: 22.3 - - elixir-version: 1.12.3 - otp-version: 23.3 - elixir-version: 1.12.3 otp-version: 24.3 - - elixir-version: 1.13.4 - otp-version: 22.3 - - elixir-version: 1.13.4 - otp-version: 23.3 - elixir-version: 1.13.4 otp-version: 24.3 - elixir-version: 1.13.4 otp-version: 25.3 - - elixir-version: 1.14.5 - otp-version: 23.3 - elixir-version: 1.14.5 otp-version: 24.3 - elixir-version: 1.14.5 @@ -72,11 +44,13 @@ jobs: - elixir-version: 1.17.3 otp-version: 26.2 - elixir-version: 1.17.3 - otp-version: 27.2 - - elixir-version: 1.18.1 + otp-version: 27.3 + - elixir-version: 1.18.4 otp-version: 26.2 - - elixir-version: 1.18.1 - otp-version: 27.2 + - elixir-version: 1.18.4 + otp-version: 27.3 + - elixir-version: 1.18.4 + otp-version: 28.0 steps: - uses: actions/checkout@v3 - name: Set up Elixir diff --git a/README.md b/README.md index b3394d8..0216058 100644 --- a/README.md +++ b/README.md @@ -164,16 +164,13 @@ For a guided tour and deep dive of Patch, see the [Guide Book](https://hexdocs.p Tests automatically run against a matrix of OTP and Elixir Versions, see the [ci.yml](https://github.com/ihumanable/patch/tree/master/.github/workflows/ci.yml) for details. -| OTP \ Elixir | 1.9 | 1.10 | 1.11 | 1.12 | 1.13 | 1.14 | 1.15 | 1.16 | 1.17 | 1.18 | -|:------------:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:| -| 20 | ✅ | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | -| 21 | ✅ | ✅ | ✅ | N/A | N/A | N/A | N/A | N/A | N/A | N/A | -| 22 | ✅ | ✅ | ✅ | ✅ | ✅ | N/A | N/A | N/A | N/A | N/A | -| 23 | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | N/A | N/A | N/A | N/A | -| 24 | N/A | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | N/A | N/A | N/A | -| 25 | N/A | N/A | N/A | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | ? | -| 26 | N/A | N/A | N/A | N/A | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | -| 27 | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | ✅ | ✅ | +| OTP \ Elixir | 1.11 | 1.12 | 1.13 | 1.14 | 1.15 | 1.16 | 1.17 | 1.18 | +|:------------:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:| +| 24 | ✅ | ✅ | ✅ | ✅ | ✅ | N/A | N/A | N/A | +| 25 | N/A | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | N/A | +| 26 | N/A | N/A | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | +| 27 | N/A | N/A | N/A | N/A | N/A | N/A | ✅ | ✅ | +| 28 | N/A | N/A | N/A | N/A | N/A | N/A | N/A | ✅ | ## Limitations From eadbc60939bfeebb6ba225d4540abfc410ef3a89 Mon Sep 17 00:00:00 2001 From: Matt Nowack Date: Tue, 3 Jun 2025 17:06:38 -0400 Subject: [PATCH 6/7] Remove OTP 28 --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 453e5f5..7c078b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,8 +49,6 @@ jobs: otp-version: 26.2 - elixir-version: 1.18.4 otp-version: 27.3 - - elixir-version: 1.18.4 - otp-version: 28.0 steps: - uses: actions/checkout@v3 - name: Set up Elixir From 83d9b2b5d01f6dbd7419d94779eba1eac79feeea Mon Sep 17 00:00:00 2001 From: Matt Nowack Date: Tue, 3 Jun 2025 17:06:47 -0400 Subject: [PATCH 7/7] update version matrix --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 0216058..6246a8b 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,6 @@ Tests automatically run against a matrix of OTP and Elixir Versions, see the [ci | 25 | N/A | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | N/A | | 26 | N/A | N/A | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | | 27 | N/A | N/A | N/A | N/A | N/A | N/A | ✅ | ✅ | -| 28 | N/A | N/A | N/A | N/A | N/A | N/A | N/A | ✅ | ## Limitations