Commit 278d9a0 1 parent 0aa51f8 commit 278d9a0 Copy full SHA for 278d9a0
File tree 7 files changed +44
-44
lines changed
lib/lexical/server/project
test/lexical/server/project
7 files changed +44
-44
lines changed Original file line number Diff line number Diff line change 1
- defmodule Lexical.Format do
1
+ defmodule Lexical.Formats do
2
2
@ moduledoc """
3
3
A collection of formatting functions
4
4
"""
@@ -54,7 +54,7 @@ defmodule Lexical.Format do
54
54
```
55
55
56
56
```
57
- Format .module(Somewhat.Nested.Module)
57
+ Formats .module(Somewhat.Nested.Module)
58
58
"Somewhat.Nested.Module"
59
59
```
60
60
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ defmodule Lexical.Server.Project.Diagnostics do
91
91
end
92
92
93
93
alias Lexical.Document
94
- alias Lexical.Format
94
+ alias Lexical.Formats
95
95
alias Lexical.Project
96
96
alias Lexical.Protocol.Notifications.PublishDiagnostics
97
97
alias Lexical.RemoteControl.Api.Messages
@@ -158,7 +158,7 @@ defmodule Lexical.Server.Project.Diagnostics do
158
158
% State { } = state
159
159
) do
160
160
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 ) } " )
162
162
163
163
{ :noreply , state }
164
164
end
Original file line number Diff line number Diff line change 1
1
defmodule Lexical.Server.Project.Intelligence do
2
2
defmodule State do
3
- alias Lexical.Format
3
+ alias Lexical.Formats
4
4
alias Lexical.Project
5
5
defstruct project: nil , struct_modules: MapSet . new ( )
6
6
@@ -36,7 +36,7 @@ defmodule Lexical.Server.Project.Intelligence do
36
36
37
37
defp module_path ( module_name ) do
38
38
module_name
39
- |> Format . module ( )
39
+ |> Formats . module ( )
40
40
|> String . split ( "." )
41
41
end
42
42
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ defmodule Lexical.Server.Project.NodeTest do
7
7
import RemoteControl.Api.Messages
8
8
9
9
use ExUnit.Case
10
- use Testing .EventualAssertions
10
+ use Lexical.Test .EventualAssertions
11
11
12
12
setup do
13
13
project = project ( )
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ defmodule Lexical.Server.Project.ProgressTest do
9
9
10
10
use ExUnit.Case
11
11
use Patch
12
- use Testing .EventualAssertions
12
+ use Lexical.Test .EventualAssertions
13
13
14
14
setup do
15
15
project = project ( )
You can’t perform that action at this time.
0 commit comments