From e5f87adee74fe0609921922cc0125d6488d35dd6 Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Sat, 14 Dec 2024 09:16:40 -0500 Subject: [PATCH] add tests for Elixir --- test/Elixir.Luerl_tests.erl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/Elixir.Luerl_tests.erl diff --git a/test/Elixir.Luerl_tests.erl b/test/Elixir.Luerl_tests.erl new file mode 100644 index 0000000..dd392a4 --- /dev/null +++ b/test/Elixir.Luerl_tests.erl @@ -0,0 +1,25 @@ +%% Copyright (C) 2024 Robert Virding +%% +%% 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. + +-module('Elixir.Luerl_tests'). + +-include_lib("eunit/include/eunit.hrl"). + +private_test() -> + State1 = 'Elixir.Luerl':init(), + State2 = 'Elixir.Luerl':put_private(State1, secret, <<"mysecret">>), + ?assertMatch(<<"mysecret">>, 'Elixir.Luerl':get_private(State2, secret)), + ?assertMatch(nil, 'Elixir.Luerl':get_private(State2, missing)), + State3 = 'Elixir.Luerl':delete_private(State2, secret), + ?assertMatch(nil, 'Elixir.Luerl':get_private(State3, secret)).