sophia/test/aeso_test_utils.erl
2025-03-01 16:06:02 +02:00

22 lines
718 B
Erlang

%%% -*- erlang-indent-level:4; indent-tabs-mode: nil -*-
%%%-------------------------------------------------------------------
%%% @copyright (C) 2017, Aeternity Anstalt
%%% @doc Test utilities for the Sophia language tests.
%%%
%%% @end
%%%-------------------------------------------------------------------
-module(aeso_test_utils).
-export([read_contract/1, contract_path/0]).
contract_path() ->
filename:join(code:lib_dir(sophia, test), "contracts").
%% Read a contract file from the test/contracts directory.
-spec read_contract(string() | atom()) -> string().
read_contract(Name) ->
{ok, Bin} = file:read_file(filename:join(contract_path(), lists:concat([Name, ".aes"]))),
binary_to_list(Bin).