-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MM-59825] Update module names for mono repo (#40)
- Loading branch information
Showing
18 changed files
with
213 additions
and
29 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
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,16 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
package errorAssertions | ||
|
||
import ( | ||
"testing" | ||
|
||
"golang.org/x/tools/go/analysis/analysistest" | ||
) | ||
|
||
func Test(t *testing.T) { | ||
appErrorType = "*model.AppError" | ||
testdata := analysistest.TestData() | ||
analysistest.Run(t, testdata, Analyzer, "model", "assert", "errorAssertions") | ||
} |
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 require | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Error(t *testing.T, err error, msgAndArgs ...interface{}) {} | ||
func Errorf(t *testing.T, err error, msg string, args ...interface{}) {} | ||
func NoError(t *testing.T, err error, msgAndArgs ...interface{}) {} | ||
func NoErrorf(t *testing.T, err error, msg string, args ...interface{}) {} | ||
func Nil(t *testing.T, object interface{}, msgAndArgs ...interface{}) {} | ||
func NotNil(t *testing.T, object interface{}, msgAndArgs ...interface{}) {} | ||
func Nilf(t *testing.T, object interface{}, msg string, args ...interface{}) {} | ||
func NotNilf(t *testing.T, object interface{}, msg string, args ...interface{}) {} |
51 changes: 51 additions & 0 deletions
51
errorAssertions/testdata/src/errorAssertions/errorassertions.go
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,51 @@ | ||
package errorAssertions | ||
|
||
import ( | ||
"testing" | ||
|
||
"assert" | ||
"model" | ||
"require" | ||
) | ||
|
||
func TestError(t *testing.T) { | ||
var err error | ||
assert.Error(t, err) | ||
assert.Errorf(t, err, "%s", "foo") | ||
assert.NoError(t, err) | ||
assert.NoErrorf(t, err, "%s", "foo") | ||
assert.Nil(t, err) // want `calling assert.Nil on error, please use assert.NoError instead` | ||
assert.Nilf(t, err, "%s", "foo") // want `calling assert.Nilf on error, please use assert.NoErrorf instead` | ||
assert.NotNil(t, err) // want `calling assert.NotNil on error, please use assert.Error instead` | ||
assert.NotNilf(t, err, "%s", "foo") // want `calling assert.NotNilf on error, please use assert.Errorf instead` | ||
|
||
require.Error(t, err) | ||
require.Errorf(t, err, "%s", "foo") | ||
require.NoError(t, err) | ||
require.NoErrorf(t, err, "%s", "foo") | ||
require.Nil(t, err) // want `calling require.Nil on error, please use require.NoError instead` | ||
require.Nilf(t, err, "%s", "foo") // want `calling require.Nilf on error, please use require.NoErrorf instead` | ||
require.NotNil(t, err) // want `calling require.NotNil on error, please use require.Error instead` | ||
require.NotNilf(t, err, "%s", "foo") // want `calling require.NotNilf on error, please use require.Errorf instead` | ||
} | ||
|
||
func TestModelAppError(t *testing.T) { | ||
var appErr *model.AppError | ||
assert.Error(t, appErr) // want `calling assert.Error on \*model.AppError, please use assert.NotNil instead` | ||
assert.Errorf(t, appErr, "%s", "foo") // want `calling assert.Errorf on \*model.AppError, please use assert.NotNilf instead` | ||
assert.NoError(t, appErr) // want `calling assert.NoError on \*model.AppError, please use assert.Nil instead` | ||
assert.NoErrorf(t, appErr, "%s", "foo") // want `calling assert.NoErrorf on \*model.AppError, please use assert.Nilf instead` | ||
assert.Nil(t, appErr) | ||
assert.Nilf(t, appErr, "%s", "foo") | ||
assert.NotNil(t, appErr) | ||
assert.NotNilf(t, appErr, "%s", "foo") | ||
|
||
require.Error(t, appErr) // want `calling require.Error on \*model.AppError, please use require.NotNil instead` | ||
require.Errorf(t, appErr, "%s", "foo") // want `calling require.Errorf on \*model.AppError, please use require.NotNilf instead` | ||
require.NoError(t, appErr) // want `calling require.NoError on \*model.AppError, please use require.Nil instead` | ||
require.NoErrorf(t, appErr, "%s", "foo") // want `calling require.NoErrorf on \*model.AppError, please use require.Nilf instead` | ||
require.Nil(t, appErr) | ||
require.Nilf(t, appErr, "%s", "foo") | ||
require.NotNil(t, appErr) | ||
require.NotNilf(t, appErr, "%s", "foo") | ||
} |
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,7 @@ | ||
package model | ||
|
||
type AppError struct{} | ||
|
||
func (a *AppError) Error() string { | ||
return "an error" | ||
} |
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 assert | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Error(t *testing.T, err error, msgAndArgs ...interface{}) {} | ||
func Errorf(t *testing.T, err error, msg string, args ...interface{}) {} | ||
func NoError(t *testing.T, err error, msgAndArgs ...interface{}) {} | ||
func NoErrorf(t *testing.T, err error, msg string, args ...interface{}) {} | ||
func Nil(t *testing.T, object interface{}, msgAndArgs ...interface{}) {} | ||
func NotNil(t *testing.T, object interface{}, msgAndArgs ...interface{}) {} | ||
func Nilf(t *testing.T, object interface{}, msg string, args ...interface{}) {} | ||
func NotNilf(t *testing.T, object interface{}, msg string, args ...interface{}) {} |
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
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
Oops, something went wrong.