Skip to content

Commit d2e6788

Browse files
committed
prepare tests for fuzzy matching
1 parent 68b5039 commit d2e6788

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

apps/language_server/test/providers/completion_test.exs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -471,16 +471,16 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
471471
setup do
472472
text = """
473473
defmodule MyModule do
474-
def add(a, b), do: a + b
474+
def add_2_numbers(a, b), do: a + b
475475
476476
def dummy_function() do
477-
ad
478-
# ^
477+
ad2n
478+
# ^
479479
end
480480
end
481481
"""
482482

483-
%{text: text, location: {4, 6}}
483+
%{text: text, location: {4, 8}}
484484
end
485485

486486
test "setting 'signature_after_complete'", context do
@@ -505,18 +505,18 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
505505
opts = Keyword.merge(@supports, snippets_supported: false, signature_help_supported: false)
506506
{:ok, %{"items" => [item]}} = Completion.completion(text, line, char, opts)
507507

508-
assert item["insertText"] == "add"
508+
assert item["insertText"] == "add_2_numbers"
509509
assert item["command"] == nil
510510

511511
opts =
512512
Keyword.merge(@supports,
513513
snippets_supported: false,
514-
locals_without_parens: MapSet.new(add: 2)
514+
locals_without_parens: MapSet.new(add_2_numbers: 2)
515515
)
516516

517517
{:ok, %{"items" => [item]}} = Completion.completion(text, line, char, opts)
518518

519-
assert item["insertText"] == "add "
519+
assert item["insertText"] == "add_2_numbers "
520520
assert item["command"] == @signature_command
521521
end
522522

@@ -529,7 +529,7 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
529529
opts = Keyword.merge(@supports, snippets_supported: false)
530530
{:ok, %{"items" => [item]}} = Completion.completion(text, line, char, opts)
531531

532-
assert item["insertText"] == "add("
532+
assert item["insertText"] == "add_2_numbers("
533533
assert item["command"] == @signature_command
534534
end
535535

@@ -542,7 +542,7 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
542542
opts = Keyword.merge(@supports, signature_help_supported: false)
543543
{:ok, %{"items" => [item]}} = Completion.completion(text, line, char, opts)
544544

545-
assert item["insertText"] == "add(${1:a}, ${2:b})"
545+
assert item["insertText"] == "add_2_numbers(${1:a}, ${2:b})"
546546
assert item["command"] == nil
547547
end
548548

@@ -554,50 +554,50 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
554554

555555
{:ok, %{"items" => [item]}} = Completion.completion(text, line, char, @supports)
556556

557-
assert item["insertText"] == "add($1)$0"
557+
assert item["insertText"] == "add_2_numbers($1)$0"
558558
assert item["command"] == @signature_command
559559
end
560560

561561
test "with snippets/signature support, before valid arg, do not close parens" do
562562
text = """
563563
defmodule MyModule do
564-
def add(a, b), do: a + b
564+
def add_2_numbers(a, b), do: a + b
565565
566566
def dummy_function() do
567-
ad100
568-
# ^
567+
ad2n100
568+
# ^
569569
end
570570
end
571571
"""
572572

573-
{line, char} = {4, 6}
573+
{line, char} = {4, 8}
574574
TestUtils.assert_has_cursor_char(text, line, char)
575575

576576
{:ok, %{"items" => [item]}} = Completion.completion(text, line, char, @supports)
577577

578-
assert item["insertText"] == "add("
578+
assert item["insertText"] == "add_2_numbers("
579579
assert item["command"] == @signature_command
580580
end
581581

582582
test "function in :locals_without_parens doesn't complete with args if there's text after cursor" do
583583
text = """
584584
defmodule MyModule do
585-
def add(a, b), do: a + b
585+
def add_2_numbers(a, b), do: a + b
586586
587587
def dummy_function() do
588-
ad 100
589-
# ^
588+
ad2n 100
589+
# ^
590590
end
591591
end
592592
"""
593593

594-
{line, char} = {4, 6}
594+
{line, char} = {4, 8}
595595
TestUtils.assert_has_cursor_char(text, line, char)
596596

597-
opts = Keyword.merge(@supports, locals_without_parens: MapSet.new(add: 2))
597+
opts = Keyword.merge(@supports, locals_without_parens: MapSet.new(add_2_numbers: 2))
598598
{:ok, %{"items" => [item]}} = Completion.completion(text, line, char, opts)
599599

600-
assert item["insertText"] == "add"
600+
assert item["insertText"] == "add_2_numbers"
601601
assert item["command"] == @signature_command
602602
end
603603

0 commit comments

Comments
 (0)