You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2025/03/11 05:28:47 UTC
(couchdb-meck) branch main updated (aa278c1 -> 29360b2)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-meck.git
from aa278c1 Handle new OTP 27 compile options
new dfb47c5 Support Erlang 27.0
new 59d61d8 Fix an issue with the code coverage in Erlang.mk
new d755909 Version 1.0.0
new 474651c Replace hardcoded version with Git tags
new 29360b2 Use ex_doc instead of edoc
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/erlang.yml | 11 +++++------
.gitignore | 5 +----
CHANGELOG.md | 17 +++++++++++-----
doc/overview.edoc | 25 -----------------------
rebar.config | 12 +++++++++++
src/meck.app.src | 2 +-
src/meck_proc.erl | 8 +++++++-
test/meck_tests.erl | 47 ++++++++++++++++++++++++++++++++------------
8 files changed, 72 insertions(+), 55 deletions(-)
delete mode 100644 doc/overview.edoc
(couchdb-meck) 05/05: Use ex_doc instead of edoc
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-meck.git
commit 29360b25b708b2dc9d68a4f46f6a1b8b55f72518
Author: Adam Lindberg <he...@alind.io>
AuthorDate: Fri Dec 13 10:16:28 2024 +0100
Use ex_doc instead of edoc
---
.gitignore | 5 +----
doc/overview.edoc | 25 -------------------------
rebar.config | 10 ++++++++++
3 files changed, 11 insertions(+), 29 deletions(-)
diff --git a/.gitignore b/.gitignore
index 770ef2e..c7b3e8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,7 +17,4 @@ logs
_build
.idea
rebar3.crashdump
-doc/*.html
-doc/edoc-info
-doc/erlang.png
-doc/stylesheet.css
+doc
diff --git a/doc/overview.edoc b/doc/overview.edoc
deleted file mode 100644
index f4624b4..0000000
--- a/doc/overview.edoc
+++ /dev/null
@@ -1,25 +0,0 @@
-%%==============================================================================
-%% Copyright 2010-2017 Adam Lindberg, 2010-2011 Erlang Solutions Ltd
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%==============================================================================
-
-@author Adam Lindberg <ep...@gmail.com>
-@copyright 2010-2017 Adam Lindberg, 2010-2011 Erlang Solutions Ltd
-@version 0.9.2
-@title meck, a Mocking Library for Erlang
-
-@doc
-
-== About ==
-meck is a mocking library for Erlang.
diff --git a/rebar.config b/rebar.config
index a013b14..381a791 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,5 +1,7 @@
{minimum_otp_vsn, "25.0"}.
+{project_plugins, [rebar3_ex_doc]}.
+
{profiles, [
{test, [
{deps, [unite]},
@@ -34,3 +36,11 @@
error_handling
]}
]}.
+
+{hex, [{doc, ex_doc}]}.
+{ex_doc, [
+ {source_url, <<"https://github.com/eproxus/meck">>},
+ {extras, [<<"README.md">>, <<"LICENSE">>]},
+ {main, <<"readme">>},
+ {prefix_ref_vsn_with_v, false}
+]}.
(couchdb-meck) 04/05: Replace hardcoded version with Git tags
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-meck.git
commit 474651c1ba7fb1f1e762b88c1616497f06825674
Author: Adam Lindberg <he...@alind.io>
AuthorDate: Fri Dec 13 10:17:06 2024 +0100
Replace hardcoded version with Git tags
---
src/meck.app.src | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/meck.app.src b/src/meck.app.src
index 6a21ac9..1f427f9 100644
--- a/src/meck.app.src
+++ b/src/meck.app.src
@@ -1,6 +1,6 @@
{application, meck, [
{description, "A mocking framework for Erlang"},
- {vsn, "0.9.2"},
+ {vsn, git},
{modules, []},
{registered, []},
{applications, [kernel, stdlib, tools, compiler]},
(couchdb-meck) 01/05: Support Erlang 27.0
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-meck.git
commit dfb47c544bdf14b5c26ff2651cf9339dbbe2f50e
Author: Adam Lindberg <he...@alind.io>
AuthorDate: Thu Feb 15 14:13:03 2024 +0100
Support Erlang 27.0
Removes no-longer supported OTP version 24. Migrates from 'slave' to
'peer' in test code.
---
.github/workflows/erlang.yml | 11 +++++------
rebar.config | 2 ++
test/meck_tests.erl | 23 ++++++++++-------------
3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/.github/workflows/erlang.yml b/.github/workflows/erlang.yml
index f9ec37f..bb626ed 100644
--- a/.github/workflows/erlang.yml
+++ b/.github/workflows/erlang.yml
@@ -7,22 +7,21 @@ on:
jobs:
ci:
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
name: Erlang ${{matrix.otp}} / rebar ${{matrix.rebar3}}
strategy:
matrix:
- otp: ['24', '25', '26']
- rebar3: ['3']
+ otp: ["25", "26", "27"]
+ rebar3: ["3"]
steps:
-
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
rebar3-version: ${{matrix.rebar3}}
- - uses: actions/cache@v3
+ - uses: actions/cache@v4
env:
cache-name: rebar3
with:
diff --git a/rebar.config b/rebar.config
index 5aac744..a013b14 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,3 +1,5 @@
+{minimum_otp_vsn, "25.0"}.
+
{profiles, [
{test, [
{deps, [unite]},
diff --git a/test/meck_tests.erl b/test/meck_tests.erl
index 5cc0066..0008f2a 100644
--- a/test/meck_tests.erl
+++ b/test/meck_tests.erl
@@ -1348,31 +1348,28 @@ remote_meck_test_() ->
remote_setup() ->
[] = os:cmd("epmd -daemon"),
- Hostname = case node() of
- 'nonode@nohost' -> "localhost";
- _ -> test_server_sup:hoststr()
- end,
- Myself = list_to_atom("meck_eunit_test@" ++ Hostname),
- net_kernel:start([Myself, shortnames]),
- {ok, Node} = slave:start_link(list_to_atom(Hostname), meck_remote_test,
- "-pa \"" ++ test_dir() ++ "\""),
+ net_kernel:start([meck_eunit_test]),
+ {ok, Pid, Node} = peer:start_link(#{
+ name => meck_remote_test,
+ args => ["-pa", test_dir()]
+ }),
{Mod, Bin, File} = code:get_object_code(meck),
true = rpc:call(Node, code, add_path, [filename:dirname(File)]),
{module, Mod} = rpc:call(Node, code, load_binary, [Mod, File, Bin]),
{module, meck_test_module} =
rpc:call(Node, code, load_file, [meck_test_module]),
- {Node, meck_test_module}.
+ {Pid, Node, meck_test_module}.
-remote_teardown({Node, _Mod}) ->
- ok = slave:stop(Node),
+remote_teardown({Pid, _Node, _Mod}) ->
+ ok = peer:stop(Pid),
ok = net_kernel:stop().
-remote_meck_({Node, Mod}) ->
+remote_meck_({_Pid, Node, Mod}) ->
?assertEqual(ok, rpc:call(Node, meck, new, [Mod, [no_link, non_strict]])),
?assertEqual(ok, rpc:call(Node, meck, expect, [Mod, test, 0, true])),
?assertEqual(true, rpc:call(Node, Mod, test, [])).
-remote_meck_cover_({Node, Mod}) ->
+remote_meck_cover_({_Pid, Node, Mod}) ->
{ok, Mod} = cover:compile(test_file(Mod, ".erl")),
{ok, _Nodes} = cover:start([Node]),
?assertEqual(ok, rpc:call(Node, meck, new, [Mod])).
(couchdb-meck) 02/05: Fix an issue with the code coverage in Erlang.mk
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-meck.git
commit 59d61d87b42408779e7863b6e8544325bcf90efd
Author: Andrei Mihăilă <an...@gmail.com>
AuthorDate: Tue Jun 25 23:21:25 2024 +0300
Fix an issue with the code coverage in Erlang.mk
It seems that just purging away the meck generated module
(in `meck:unload`) is not removing it from the cover data.
Exporting the cover data using `cover:export/1` will also
export data about the meck generated module. Erlang.mk
[uses](https://github.com/ninenines/erlang.mk/blob/b8a27ab752389394bfdb8c15d1b69455c313991e/plugins/cover.mk#L52)
the export & import flow to generate the HTML coverage report,
so the report will show the purged module - which is not correct.
This might be due to an issue in the coverage tool and it would be
better to investigate and fix it there, but this fix shouldn't break
anything, so I think it is acceptable.
---
src/meck_proc.erl | 8 +++++++-
test/meck_tests.erl | 24 ++++++++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/meck_proc.erl b/src/meck_proc.erl
index 459246f..0a14193 100644
--- a/src/meck_proc.erl
+++ b/src/meck_proc.erl
@@ -660,7 +660,13 @@ cleanup(Mod) ->
code:purge(Mod),
code:delete(Mod),
code:purge(meck_util:original_name(Mod)),
- code:delete(meck_util:original_name(Mod)).
+ Res = code:delete(meck_util:original_name(Mod)),
+
+ % `cover:export` might still export the meck generated module,
+ % make sure that does not happen.
+ _ = cover:reset(meck_util:original_name(Mod)),
+
+ Res.
-spec times_called(OptFunc::'_' | atom(),
meck_args_matcher:args_matcher(),
diff --git a/test/meck_tests.erl b/test/meck_tests.erl
index 0008f2a..0c33988 100644
--- a/test/meck_tests.erl
+++ b/test/meck_tests.erl
@@ -1181,6 +1181,30 @@ cover_passthrough_test() ->
?assertEqual({ok, {meck_test_module, {2,1}}},
cover:analyze(meck_test_module, module)).
+cover_no_meck_original_in_cover_export_test() ->
+ {ok, _} = cover:compile("test/meck_test_module.erl"),
+
+ passthrough_test([]),
+
+ Filename =
+ lists:flatten(
+ io_lib:format(
+ "tmp_~b_~p.coverdata",
+ [rand:uniform(100_000), meck_util:original_name(meck_test_module)]
+ )
+ ),
+ try
+ ok = cover:export(Filename),
+ ok = cover:import(Filename)
+ after
+ _ = file:delete(Filename)
+ end,
+
+ ?assertNot(
+ lists:member(meck_util:original_name(meck_test_module), cover:imported_modules()),
+ "the meck generated module should not be in the exported cover data"
+ ).
+
cover_path_test() ->
{ok, _} = cover:compile("test/meck_test_module.erl"),
?assertEqual({ok, {meck_test_module, {0,3}}},
(couchdb-meck) 03/05: Version 1.0.0
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-meck.git
commit d755909a477048d5a69a5597351cbbf9d6c71a9a
Author: Adam Lindberg <he...@alind.io>
AuthorDate: Fri Dec 13 10:00:22 2024 +0100
Version 1.0.0
---
CHANGELOG.md | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index acd393c..096dfbe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,20 +7,27 @@ The format is based on [Keep a Changelog], and this project adheres to
## [Unreleased]
+## [1.0.0] - 2024-06-28
+
### Added
-- Leave module loaded state as it was [\#228](https://github.com/eproxus/meck/pull/228)
+- Official support for Erlang 27.0
+- Reload modules that were loaded before mocking ([\#228](https://github.com/eproxus/meck/pull/228))
### Fixed
-- Fix misleading not_mocked errors when when unloading a mock [\#231](https://github.com/eproxus/meck/pull/231)
+- Fix misleading not_mocked errors when unloading a mock [\#231](https://github.com/eproxus/meck/pull/231)
- Fix calling mocked modules from expectations fun [\#232](https://github.com/eproxus/meck/pull/232)
+- Fix spec of meck:raise/2
+- Increase meck_proc stop timeout to infinity to prevent confusing errors
+- Code coverage leak from temporary backup modules in Erlang.mk [\#246](https://github.com/eproxus/meck/pull/246)
### Removed
-- Compatibility for Erlang versions below 22. Meck will follow the compatible
- Erlang versions of Rebar 3 for future releases. Older versions might still
- work but there is no guarantee and no support.
+- Compatibility for Erlang versions below 22. Meck will follow the officially
+ supported Erlang versions for future releases (latest major and two previous
+ versions). Older versions might still work but there is no guarantee and no
+ support.
## [0.9.2] - 2021-03-06