-
-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
facts: move relevant tests into facts package
- Loading branch information
Showing
6 changed files
with
40 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package facts | ||
|
||
import ( | ||
"testing" | ||
|
||
"golang.org/x/tools/go/analysis/analysistest" | ||
) | ||
|
||
func TestDeprecated(t *testing.T) { | ||
analysistest.Run(t, analysistest.TestData(), Deprecated, "Deprecated") | ||
} | ||
|
||
func TestPurity(t *testing.T) { | ||
analysistest.Run(t, analysistest.TestData(), Purity, "Purity") | ||
} |
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,5 @@ | ||
package pkg | ||
|
||
// Deprecated: Don't use this. | ||
func fn2() { // want fn2:`Deprecated: Don't use this\.` | ||
} |
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,17 @@ | ||
package pkg | ||
|
||
func foo(a, b int) int { return a + b } // want foo:"is pure" | ||
func bar(a, b int) int { | ||
println(a + b) | ||
return a + b | ||
} | ||
|
||
func empty() {} | ||
func stubPointer() *int { return nil } | ||
func stubInt() int { return 0 } | ||
|
||
func fn3() { | ||
empty() | ||
stubPointer() | ||
stubInt() | ||
} |
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