diff --git a/apps/common/lib/lexical/format.ex b/apps/common/lib/lexical/formats.ex similarity index 95% rename from apps/common/lib/lexical/format.ex rename to apps/common/lib/lexical/formats.ex index 9c1adb5af..2875d041d 100644 --- a/apps/common/lib/lexical/format.ex +++ b/apps/common/lib/lexical/formats.ex @@ -1,4 +1,4 @@ -defmodule Lexical.Format do +defmodule Lexical.Formats do @moduledoc """ A collection of formatting functions """ @@ -54,7 +54,7 @@ defmodule Lexical.Format do ``` ``` - Format.module(Somewhat.Nested.Module) + Formats.module(Somewhat.Nested.Module) "Somewhat.Nested.Module" ``` diff --git a/apps/common/test/lexical/format_test.exs b/apps/common/test/lexical/format_test.exs deleted file mode 100644 index 252c6745a..000000000 --- a/apps/common/test/lexical/format_test.exs +++ /dev/null @@ -1,36 +0,0 @@ -defmodule Lexical.FormatTest do - alias Lexical.Format - - use ExUnit.Case - - describe "stringifying modules" do - test "it correctly handles a top-level module" do - assert "Lexical" == Format.module(Lexical) - end - - test "it correctly handles a nested module" do - assert "Lexical.Text" == Format.module(Lexical.Text) - end - - test "it correctly handles an erlang module name" do - assert ":ets" == Format.module(:ets) - end - end - - describe "formatting time" do - test "it handles milliseconds" do - assert "1.0 seconds" = Format.time(1000, unit: :millisecond) - assert "1.5 seconds" = Format.time(1500, unit: :millisecond) - end - - test "microseconds is the default" do - assert "150 ms" = Format.time(150_000) - end - - test "it handles microseconds" do - assert "2 ms" = Format.time(2000) - assert "0.2 ms" = Format.time(200) - assert "0.02 ms" = Format.time(20) - end - end -end diff --git a/apps/common/test/lexical/formats_test.exs b/apps/common/test/lexical/formats_test.exs new file mode 100644 index 000000000..b4f73ee95 --- /dev/null +++ b/apps/common/test/lexical/formats_test.exs @@ -0,0 +1,36 @@ +defmodule Lexical.FormatsTest do + alias Lexical.Formats + + use ExUnit.Case + + describe "stringifying modules" do + test "it correctly handles a top-level module" do + assert "Lexical" == Formats.module(Lexical) + end + + test "it correctly handles a nested module" do + assert "Lexical.Text" == Formats.module(Lexical.Text) + end + + test "it correctly handles an erlang module name" do + assert ":ets" == Formats.module(:ets) + end + end + + describe "formatting time" do + test "it handles milliseconds" do + assert "1.0 seconds" = Formats.time(1000, unit: :millisecond) + assert "1.5 seconds" = Formats.time(1500, unit: :millisecond) + end + + test "microseconds is the default" do + assert "150 ms" = Formats.time(150_000) + end + + test "it handles microseconds" do + assert "2 ms" = Formats.time(2000) + assert "0.2 ms" = Formats.time(200) + assert "0.02 ms" = Formats.time(20) + end + end +end diff --git a/apps/server/lib/lexical/server/project/diagnostics.ex b/apps/server/lib/lexical/server/project/diagnostics.ex index 4a558aabd..b5f621dcf 100644 --- a/apps/server/lib/lexical/server/project/diagnostics.ex +++ b/apps/server/lib/lexical/server/project/diagnostics.ex @@ -91,7 +91,7 @@ defmodule Lexical.Server.Project.Diagnostics do end alias Lexical.Document - alias Lexical.Format + alias Lexical.Formats alias Lexical.Project alias Lexical.Protocol.Notifications.PublishDiagnostics alias Lexical.RemoteControl.Api.Messages @@ -158,7 +158,7 @@ defmodule Lexical.Server.Project.Diagnostics do %State{} = state ) do project_name = Project.name(state.project) - Logger.info("Compiled #{project_name} in #{Format.time(elapsed_ms, unit: :millisecond)}") + Logger.info("Compiled #{project_name} in #{Formats.time(elapsed_ms, unit: :millisecond)}") {:noreply, state} end diff --git a/apps/server/lib/lexical/server/project/intelligence.ex b/apps/server/lib/lexical/server/project/intelligence.ex index 1c7bce837..37aedb23d 100644 --- a/apps/server/lib/lexical/server/project/intelligence.ex +++ b/apps/server/lib/lexical/server/project/intelligence.ex @@ -1,6 +1,6 @@ defmodule Lexical.Server.Project.Intelligence do defmodule State do - alias Lexical.Format + alias Lexical.Formats alias Lexical.Project defstruct project: nil, struct_modules: MapSet.new() @@ -36,7 +36,7 @@ defmodule Lexical.Server.Project.Intelligence do defp module_path(module_name) do module_name - |> Format.module() + |> Formats.module() |> String.split(".") end diff --git a/apps/server/test/lexical/server/project/node_test.exs b/apps/server/test/lexical/server/project/node_test.exs index 602af3d16..97c114a2a 100644 --- a/apps/server/test/lexical/server/project/node_test.exs +++ b/apps/server/test/lexical/server/project/node_test.exs @@ -7,7 +7,7 @@ defmodule Lexical.Server.Project.NodeTest do import RemoteControl.Api.Messages use ExUnit.Case - use Testing.EventualAssertions + use Lexical.Test.EventualAssertions setup do project = project() diff --git a/apps/server/test/lexical/server/project/progress_test.exs b/apps/server/test/lexical/server/project/progress_test.exs index c355dbb42..825e5c6b2 100644 --- a/apps/server/test/lexical/server/project/progress_test.exs +++ b/apps/server/test/lexical/server/project/progress_test.exs @@ -9,7 +9,7 @@ defmodule Lexical.Server.Project.ProgressTest do use ExUnit.Case use Patch - use Testing.EventualAssertions + use Lexical.Test.EventualAssertions setup do project = project()