From 0ec870647cc030c58278863c68c1067e76cec0e8 Mon Sep 17 00:00:00 2001 From: Bart Blast Date: Tue, 12 Nov 2024 22:11:53 +0100 Subject: [PATCH] Use ordinal/1 in build_argument_error_msg/2 --- test/elixir/support/helpers.ex | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/elixir/support/helpers.ex b/test/elixir/support/helpers.ex index 049bc5109..96f638d30 100644 --- a/test/elixir/support/helpers.ex +++ b/test/elixir/support/helpers.ex @@ -6,6 +6,7 @@ defmodule Hologram.Test.Helpers do alias Hologram.Commons.ETS alias Hologram.Commons.FileUtils + alias Hologram.Commons.IntegerUtils alias Hologram.Commons.KernelUtils alias Hologram.Commons.ProcessUtils alias Hologram.Compiler.AST @@ -72,14 +73,10 @@ defmodule Hologram.Test.Helpers do """ @spec build_argument_error_msg(integer(), String.t()) :: String.t() def build_argument_error_msg(arg_idx, blame) do - # Based on: https://stackoverflow.com/a/39466341/13040586 - suffix_idx = rem(rem(arg_idx + 90, 100) - 10, 10) - 1 - suffix = Enum.at(["st", "nd", "rd"], suffix_idx, "th") - """ errors were found at the given arguments: - * #{arg_idx}#{suffix} argument: #{blame} + * #{IntegerUtils.ordinal(arg_idx)} argument: #{blame} """ end