Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
A mocking library for Erlang
| Date | Stars |
|---|---|
| 2026-07-24 | 839 |
| 2026-07-25 | 839 |
| 2026-07-28 | 839 |
| 2026-07-30 | 839 |
| 2026-08-06 | 839 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
<h1 align="center">Meck</h1>
<p align="center">A mocking library for Erlang</p>
<p align="center">
<a href="https://github.com/eproxus/meck/actions/workflows/erlang.yml">
<img alt="GitHub Actions" src="https://img.shields.io/github/actions/workflow/status/eproxus/meck/erlang.yml?branch=master&style=flat-square"/>
</a>
<a href="https://hex.pm/packages/meck">
<img alt="Hex.pm version" src="https://img.shields.io/hexpm/v/meck?style=flat-square"/>
</a>
<a href="LICENSE">
<img alt="Hex.pm license" src="https://img.shields.io/hexpm/l/meck?style=flat-square"/>
</a>
<a href="https://github.com/eproxus/meck/blob/master/.github/workflows/erlang.yml#L14">
<img alt="Erlang versions" src="https://img.shields.io/badge/erlang-27+-blue.svg?style=flat-square"/>
</a>
<a href="https://github.com/sponsors/eproxus">
<img alt="hex.pm license" src="https://img.shields.io/github/sponsors/eproxus?style=flat-square&color=%23ec6cb9"/>
</a>
</p>
* [Features](#features)
* [Examples](#examples)
* [Use](#use)
* [Manual Build](#manual-build)
* [Caveats](#caveats)
* [Contribute](#contribute)
## Features
See what's new in [0.8 Release Notes][release_notes_0.8].
* Dynamic return values using sequences and loops of static values
* Compact definition of mock arguments, clauses and return values
* Pass through: call functions in the original module
* Complete call history showing calls, return values and exceptions
* Mock validation, will invalidate mocks that were not called correctly
* Throwing of expected exceptions that keeps the module valid
* Throws an error when mocking a module that doesn't exist or has been
renamed (disable with option `non_strict`)
* Support for [Hamcrest][hamcrest] matchers
* Automatic backup and restore of cover data
* Mock is linked to the creating process and will unload automatically
when a crash occurs (disable with option `no_link`)
* Mocking of sticky modules (using the option `unstick`)
## Examples
Here's an example of using Meck in the Erlang shell:
```erlang
Eshell V5.8.4 (abort with ^G)
1> meck:new(dog, [non_strict]). % non_strict is used to create modules that don't exist
ok
2> meck:expect(dog, bark, fun() -> "Woof!" end).
ok
3> dog:bark().
"Woof!"
4> meck:validate(dog).
true
5> meck:unload(dog).
ok
6> dog:bark().
** exception error: undefined function dog:bark/0
```
Exceptions can be anticipated by Meck (resulting in validation still passing).
This is intended to be used to test code that can and should handle certain
exceptions indeed does take care of them:
```erlang
5> meck:expect(dog, meow, fun() -> meck:exception(error, not_a_cat) end).
ok
6> catch dog:meow().
{'EXIT',{not_a_cat,[{meck,exception,2},
{meck,exec,4},
{dog,meow,[]},
{erl_eval,do_apply,5},
{erl_eval,expr,5},
{shell,exprs,6},
{shell,eval_exprs,6},
{shell,eval_loop,3}]}}
7> meck:validate(dog).
true
```
Normal Erlang exceptions result in a failed validation. The following example is
just to demonstrate the behavior, in real test code the exception would normally
come from the code under test (which should, if not expected, invalidate the
mocked module):
```erlang
8> meck:expect(dog, jump, fun(Height) when Height > 3 ->
erlang:error(too_high);
(Height) ->
ok
end).
ok
9> dog:jump(2).
ok
10> catch dog:jump(5).
{'EXIT',{too_high,[{meck,exec,4},
{dog,jump,[5]},
{erl_eval,do_apply,5},
{erl_eval,expr,5},
{shell,exprs,6},
{shell,eval_exprs,6},
{shell,eval_loop,3}]}}
11> meck:validate(dog).
false
```
Here's an example of using Meck inside an EUnit test case:
```erlang
my_test() ->
meck:new(my_librarExcerpt of 10,151 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:eaaaab6aa99ad9c9, topic:testing