this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix deprecation warnings on gleam_stdlib 0.53

authored by

Richard Viney and committed by
Louis Pilfold
3e510496 8accaa01

+14 -7
+4
CHANGELOG.md
··· 1 1 # Changelog 2 2 3 + ## Unreleased 4 + 5 + - Fixed deprecation warnings with the Gleam standard library v0.53.0 or later. 6 + 3 7 ## v1.2.0 - 2024-06-20 4 8 5 9 - The Gleam standard library version requirement has been relaxed to
+2 -6
src/gleeunit.gleam
··· 1 - import gleam/dynamic.{type Dynamic} 2 1 import gleam/list 3 - import gleam/result 4 2 import gleam/string 5 3 6 4 /// Find and run all test functions for the current project using Erlang's EUnit ··· 24 22 |> list.map(gleam_to_erlang_module_name) 25 23 |> list.map(dangerously_convert_string_to_atom(_, Utf8)) 26 24 |> run_eunit(options) 27 - |> dynamic.result(dynamic.dynamic, dynamic.dynamic) 28 - |> result.unwrap(Error(dynamic.from(Nil))) 29 25 30 26 let code = case result { 31 27 Ok(_) -> 0 ··· 70 66 Report(#(ReportModuleName, List(GleeunitProgressOption))) 71 67 } 72 68 73 - @external(erlang, "eunit", "test") 74 - fn run_eunit(a: List(Atom), b: List(EunitOption)) -> Dynamic 69 + @external(erlang, "gleeunit_ffi", "run_eunit") 70 + fn run_eunit(a: List(Atom), b: List(EunitOption)) -> Result(Nil, a)
+8 -1
src/gleeunit_ffi.erl
··· 1 1 -module(gleeunit_ffi). 2 2 3 3 -export([find_files/2, should_equal/2, should_not_equal/2, should_be_ok/1, 4 - should_be_error/1]). 4 + should_be_error/1, run_eunit/2]). 5 5 6 6 -include_lib("eunit/include/eunit.hrl"). 7 7 ··· 22 22 should_be_error(A) -> 23 23 ?assertMatch({error, _}, A), 24 24 element(2, A). 25 + 26 + run_eunit(Tests, Options) -> 27 + case eunit:test(Tests, Options) of 28 + ok -> {ok, nil}; 29 + error -> {error, nil}; 30 + {error, Term} -> {error, Term} 31 + end.