From b15dac2b8849754d58ebde3b57bbb75776ba869b Mon Sep 17 00:00:00 2001 From: Robert Findley Date: Tue, 30 Aug 2022 14:40:12 -0400 Subject: gopls: migrate internal/lsp to gopls/internal/lsp This CL was created using the following commands: ./gopls/internal/migrate.sh git add . git codereview gofmt For golang/go#54509 Change-Id: Iceeec602748a5e6f609c3ceda8d19157e5c94009 Reviewed-on: https://go-review.googlesource.com/c/tools/+/426796 gopls-CI: kokoro Run-TryBot: Robert Findley Reviewed-by: Peter Weinberger TryBot-Result: Gopher Robot --- .../lsp/source/completion/deep_completion_test.go | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 gopls/internal/lsp/source/completion/deep_completion_test.go (limited to 'gopls/internal/lsp/source/completion/deep_completion_test.go') diff --git a/gopls/internal/lsp/source/completion/deep_completion_test.go b/gopls/internal/lsp/source/completion/deep_completion_test.go new file mode 100644 index 000000000..27009af1b --- /dev/null +++ b/gopls/internal/lsp/source/completion/deep_completion_test.go @@ -0,0 +1,33 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package completion + +import ( + "testing" +) + +func TestDeepCompletionIsHighScore(t *testing.T) { + // Test that deepCompletionState.isHighScore properly tracks the top + // N=MaxDeepCompletions scores. + + var s deepCompletionState + + if !s.isHighScore(1) { + // No other scores yet, anything is a winner. + t.Error("1 should be high score") + } + + // Fill up with higher scores. + for i := 0; i < MaxDeepCompletions; i++ { + if !s.isHighScore(10) { + t.Error("10 should be high score") + } + } + + // High scores should be filled with 10s so 2 is not a high score. + if s.isHighScore(2) { + t.Error("2 shouldn't be high score") + } +} -- cgit v1.2.3