-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: properly handle XTestGoFiles (#225)
- Loading branch information
1 parent
57cece8
commit 04f3d44
Showing
5 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package x | ||
|
||
func Add(a, b int) int { return a + b } | ||
func internal() string { return "private" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package x_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/fredrikaverpil/neotest-golang/x" | ||
) | ||
|
||
func TestBlackBox(t *testing.T) { | ||
// Can only access Add() through the public interface of x. | ||
if x.Add(1, 2) != 3 { | ||
t.Fail() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package x | ||
|
||
import "testing" | ||
|
||
func TestWhiteBox(t *testing.T) { | ||
// Can access both Add() and internal() | ||
if Add(1, 2) != 3 { | ||
t.Fail() | ||
} | ||
if internal() != "private" { | ||
t.Fail() | ||
} | ||
} |