Erlymock
An EasyMock inspired mocking library for erlang.
Install / Use
/learn @sheyll/ErlymockREADME
Erlang Module Mocking
Easy to use mocking library for unit testing
Example
prouction.erl:
find_and_read_book(Isbn) ->
{ok, Book} = library:lookup({isbn, Isbn}),
media:view_book(Book).
production_test.erl:
take_book_test() ->
Mock = em:new(),
ISBN = '978-3-596-17577-2',
%% expectations:
em:strict(Mock, library, lookup, [{isbn, ISBN}], {return, {ok, some_book_id}}).
em:strict(Mock, media, view_book, [some_book_id], {return, ok}),
em:replay(Mock),
%% Run code under test:
production:find_and_read_book(ISBN),
%% assertions:
em:verify(Mock).
Installation
Rebar3 and hex.pm recommended.
Add this to your rebar.config:
{em, "7.2.6"}
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
