codelens: fix regexps for test funcs names

Include funcs without suffixes such as "Test", "Example" and "Benchmark".

Change-Id: I7d813f88c5f9dafdaea95de8f10d57a4d1a28aeb
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/344130
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Suzy Mueller <suzmue@golang.org>
diff --git a/src/testUtils.ts b/src/testUtils.ts
index c33bad1..ef91f6d 100644
--- a/src/testUtils.ts
+++ b/src/testUtils.ts
@@ -37,9 +37,9 @@
 // There could be slight difference between \P{Ll} (not lowercase letter)
 // & go unicode package's uppercase detection. But hopefully
 // these will be replaced by gopls's codelens computation soon.
-const testFuncRegex = /^Test\P{Ll}.*|^Example\P{Ll}.*/u;
-const testMethodRegex = /^\(([^)]+)\)\.(Test\P{Ll}.*)$/u;
-const benchmarkRegex = /^Benchmark\P{Ll}.*/u;
+const testFuncRegex = /^Test$|^Test\P{Ll}.*|^Example$|^Example\P{Ll}.*/u;
+const testMethodRegex = /^\(([^)]+)\)\.(Test|Test\P{Ll}.*)$/u;
+const benchmarkRegex = /^Benchmark$|^Benchmark\P{Ll}.*/u;
 
 /**
  * Input to goTest.
diff --git a/test/integration/codelens.test.ts b/test/integration/codelens.test.ts
index 7d522d3..67b4f5c 100644
--- a/test/integration/codelens.test.ts
+++ b/test/integration/codelens.test.ts
@@ -143,7 +143,7 @@
 		const uri = vscode.Uri.file(path.join(fixturePath, 'codelens2_test.go'));
 		const benchmarkDocument = await vscode.workspace.openTextDocument(uri);
 		const codeLenses = await codeLensProvider.provideCodeLenses(benchmarkDocument, cancellationTokenSource.token);
-		assert.equal(codeLenses.length, 12, JSON.stringify(codeLenses, null, 2));
+		assert.equal(codeLenses.length, 18, JSON.stringify(codeLenses, null, 2));
 		const found = [] as string[];
 		for (let i = 0; i < codeLenses.length; i++) {
 			const lens = codeLenses[i];
@@ -153,6 +153,15 @@
 		}
 		found.sort();
 		// Results should match `go test -list`.
-		assert.deepStrictEqual(found, ['Test1Function', 'TestFunction', 'Test_foobar', 'TestΣυνάρτηση', 'Test함수']);
+		assert.deepStrictEqual(found, [
+			'Example',
+			'ExampleFunction',
+			'Test',
+			'Test1Function',
+			'TestFunction',
+			'Test_foobar',
+			'TestΣυνάρτηση',
+			'Test함수'
+		]);
 	});
 });
diff --git a/test/testdata/codelens/codelens2_test.go b/test/testdata/codelens/codelens2_test.go
index 405f4ef..888f534 100644
--- a/test/testdata/codelens/codelens2_test.go
+++ b/test/testdata/codelens/codelens2_test.go
@@ -1,6 +1,7 @@
 package main
 
 import (
+	"fmt"
 	"testing"
 )
 
@@ -10,6 +11,7 @@
 //   TestΣυνάρτηση
 //   Test함수
 //   Test_foobar
+//   Test
 func TestFunction(t *testing.T) {
 	t.Log("this is a valid test function")
 }
@@ -36,4 +38,20 @@
 
 func Test_foobar(t *testing.T) {
 	t.Log("this is an acceptable test function")
-}
\ No newline at end of file
+}
+
+func Test(t *testing.T) {
+	t.Log("this is a valid test function")
+}
+
+func ExampleFunction() {
+	fmt.Println("this is a valid example function")
+	// Output:
+	// this is a valid example function
+}
+
+func Example() {
+	fmt.Println("this is a valid example function")
+	// Output:
+	// this is a valid example function
+}