-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
e1c5c69
commit 7eb1ed2
Showing
3 changed files
with
94 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package epsearchast_v3 | ||
|
||
import ( | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func TestReduceNilAstDoesNotPanic(t *testing.T) { | ||
// Fixture Setup | ||
var ast *AstNode = nil | ||
|
||
// Execute SUT | ||
result, err := ReduceAst(ast, func(*AstNode, []*string) (*string, error) { | ||
panic("should not be called") | ||
}) | ||
|
||
// Verification | ||
require.NoError(t, err) | ||
require.Nil(t, result) | ||
} |
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,71 @@ | ||
package epsearchast_v3 | ||
|
||
import ( | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func TestSemanticReduceNilAstDoesNotPanic(t *testing.T) { | ||
// Fixture Setup | ||
var ast *AstNode = nil | ||
|
||
// Execute SUT | ||
reducer := PanicyReducer{} | ||
|
||
result, err := SemanticReduceAst(ast, reducer) | ||
|
||
// Verification | ||
require.NoError(t, err) | ||
require.Nil(t, result) | ||
} | ||
|
||
type PanicyReducer struct { | ||
} | ||
|
||
func (p PanicyReducer) PostVisitAnd(rs []*string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitIn(args ...string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitEq(first, second string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitLe(first, second string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitLt(first, second string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitGe(first, second string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitGt(first, second string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitLike(first, second string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitILike(first, second string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitContains(first, second string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitText(first, second string) (*string, error) { | ||
panic("not called") | ||
} | ||
|
||
func (p PanicyReducer) VisitIsNull(first string) (*string, error) { | ||
panic("not called") | ||
} |