Skip to content

Commit 278d9a0

Browse files
committed
Format -> Formats
1 parent 0aa51f8 commit 278d9a0

File tree

7 files changed

+44
-44
lines changed

7 files changed

+44
-44
lines changed

apps/common/lib/lexical/format.ex apps/common/lib/lexical/formats.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule Lexical.Format do
1+
defmodule Lexical.Formats do
22
@moduledoc """
33
A collection of formatting functions
44
"""
@@ -54,7 +54,7 @@ defmodule Lexical.Format do
5454
```
5555
5656
```
57-
Format.module(Somewhat.Nested.Module)
57+
Formats.module(Somewhat.Nested.Module)
5858
"Somewhat.Nested.Module"
5959
```
6060

apps/common/test/lexical/format_test.exs

-36
This file was deleted.
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
defmodule Lexical.FormatsTest do
2+
alias Lexical.Formats
3+
4+
use ExUnit.Case
5+
6+
describe "stringifying modules" do
7+
test "it correctly handles a top-level module" do
8+
assert "Lexical" == Formats.module(Lexical)
9+
end
10+
11+
test "it correctly handles a nested module" do
12+
assert "Lexical.Text" == Formats.module(Lexical.Text)
13+
end
14+
15+
test "it correctly handles an erlang module name" do
16+
assert ":ets" == Formats.module(:ets)
17+
end
18+
end
19+
20+
describe "formatting time" do
21+
test "it handles milliseconds" do
22+
assert "1.0 seconds" = Formats.time(1000, unit: :millisecond)
23+
assert "1.5 seconds" = Formats.time(1500, unit: :millisecond)
24+
end
25+
26+
test "microseconds is the default" do
27+
assert "150 ms" = Formats.time(150_000)
28+
end
29+
30+
test "it handles microseconds" do
31+
assert "2 ms" = Formats.time(2000)
32+
assert "0.2 ms" = Formats.time(200)
33+
assert "0.02 ms" = Formats.time(20)
34+
end
35+
end
36+
end

apps/server/lib/lexical/server/project/diagnostics.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ defmodule Lexical.Server.Project.Diagnostics do
9191
end
9292

9393
alias Lexical.Document
94-
alias Lexical.Format
94+
alias Lexical.Formats
9595
alias Lexical.Project
9696
alias Lexical.Protocol.Notifications.PublishDiagnostics
9797
alias Lexical.RemoteControl.Api.Messages
@@ -158,7 +158,7 @@ defmodule Lexical.Server.Project.Diagnostics do
158158
%State{} = state
159159
) do
160160
project_name = Project.name(state.project)
161-
Logger.info("Compiled #{project_name} in #{Format.time(elapsed_ms, unit: :millisecond)}")
161+
Logger.info("Compiled #{project_name} in #{Formats.time(elapsed_ms, unit: :millisecond)}")
162162

163163
{:noreply, state}
164164
end

apps/server/lib/lexical/server/project/intelligence.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
defmodule Lexical.Server.Project.Intelligence do
22
defmodule State do
3-
alias Lexical.Format
3+
alias Lexical.Formats
44
alias Lexical.Project
55
defstruct project: nil, struct_modules: MapSet.new()
66

@@ -36,7 +36,7 @@ defmodule Lexical.Server.Project.Intelligence do
3636

3737
defp module_path(module_name) do
3838
module_name
39-
|> Format.module()
39+
|> Formats.module()
4040
|> String.split(".")
4141
end
4242

apps/server/test/lexical/server/project/node_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule Lexical.Server.Project.NodeTest do
77
import RemoteControl.Api.Messages
88

99
use ExUnit.Case
10-
use Testing.EventualAssertions
10+
use Lexical.Test.EventualAssertions
1111

1212
setup do
1313
project = project()

apps/server/test/lexical/server/project/progress_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defmodule Lexical.Server.Project.ProgressTest do
99

1010
use ExUnit.Case
1111
use Patch
12-
use Testing.EventualAssertions
12+
use Lexical.Test.EventualAssertions
1313

1414
setup do
1515
project = project()

0 commit comments

Comments
 (0)