prysm-pulse/tools/analyzers/comparesame/testdata/compare_len.go
rkapka 6228b3cd9f
Identical expression comparison analyzer (#7066)
* static analyzer with tests
* Merge branch 'origin-master' into identical-expression-comparison-analyzer
* resolve analyzer errors
* Merge branch 'origin-master' into identical-expression-comparison-analyzer
* change excluded file in nogo_config
* remove tests from bazel file
* exclude test file explicitly
* extracted common code to helper file
* Revert "extracted common code to helper file"

This reverts commit e9ccea73604c920451975214d0305e6d16943b3c.
* Merge refs/heads/master into identical-expression-comparison-analyzer
* Merge refs/heads/master into identical-expression-comparison-analyzer
2020-08-21 16:48:27 +00:00

38 lines
1018 B
Go

package testdata
func Equal() {
x := []string{"a"}
if len(x) == len(x) { // want "Boolean expression has identical expressions on both sides. The result is always true."
}
}
func NotEqual() {
x := []string{"a"}
if len(x) != len(x) { // want "Boolean expression has identical expressions on both sides. The result is always true."
}
}
func GreaterThanOrEqual() {
x := []string{"a"}
if len(x) >= len(x) { // want "Boolean expression has identical expressions on both sides. The result is always true."
}
}
func LessThanOrEqual() {
x := []string{"a"}
if len(x) <= len(x) { // want "Boolean expression has identical expressions on both sides. The result is always true."
}
}
func GreaterThan() {
x := []string{"a"}
if len(x) > len(x) { // want "Boolean expression has identical expressions on both sides. The result is always false."
}
}
func LessThan() {
x := []string{"a"}
if len(x) < len(x) { // want "Boolean expression has identical expressions on both sides. The result is always false."
}
}