Skip to content

Commit

Permalink
Format -> Formats
Browse files Browse the repository at this point in the history
  • Loading branch information
scohen committed May 12, 2023
1 parent 0aa51f8 commit 278d9a0
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Lexical.Format do
defmodule Lexical.Formats do
@moduledoc """
A collection of formatting functions
"""
Expand Down Expand Up @@ -54,7 +54,7 @@ defmodule Lexical.Format do
```
```
Format.module(Somewhat.Nested.Module)
Formats.module(Somewhat.Nested.Module)
"Somewhat.Nested.Module"
```
Expand Down
36 changes: 0 additions & 36 deletions apps/common/test/lexical/format_test.exs

This file was deleted.

36 changes: 36 additions & 0 deletions apps/common/test/lexical/formats_test.exs
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions apps/server/lib/lexical/server/project/diagnostics.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions apps/server/lib/lexical/server/project/intelligence.ex
Original file line number Diff line number Diff line change
@@ -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()

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion apps/server/test/lexical/server/project/node_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion apps/server/test/lexical/server/project/progress_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 278d9a0

Please sign in to comment.