Skip to content

Commit

Permalink
Create FOUND_NULL_CONTEXT_ERR_MSG
Browse files Browse the repository at this point in the history
  • Loading branch information
sbpann committed Jun 8, 2024
1 parent 0c32adc commit e60262a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bucharest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ import (
"gorm.io/gorm"
)

const FOUND_NULL_CONTEXT_ERR_MSG = "Found null context."

func TestNewContextWithOptions(t *testing.T) {
ctx := NewContextWithOptions(nil)
if ctx == nil {
t.Fatalf("NewContext returned nil")
t.Fatal(FOUND_NULL_CONTEXT_ERR_MSG)
}
select {
case x := <-ctx.Done():
Expand All @@ -34,7 +36,7 @@ func TestNewContextWithOptions(t *testing.T) {
func TestNewContextWithOptionsFromParentContext(t *testing.T) {
ctx := NewContextWithOptions(&ContextOptions{Parent: context.Background()})
if ctx == nil {
t.Fatalf("NewContext returned nil")
t.Fatal(FOUND_NULL_CONTEXT_ERR_MSG)
}
select {
case x := <-ctx.Done():
Expand All @@ -49,7 +51,7 @@ func TestNewContextWithOptionsFromParentContext(t *testing.T) {
func TestNewContextWithOptionsWithNoAddtionalOptions(t *testing.T) {
ctx := NewContextWithOptions(&ContextOptions{Parent: context.Background()})
if ctx == nil {
t.Fatalf("NewContext returned nil")
t.Fatal(FOUND_NULL_CONTEXT_ERR_MSG)
}
select {
case x := <-ctx.Done():
Expand Down Expand Up @@ -101,7 +103,7 @@ func TestNewContextWithOptionsWithAllAddtionalOptions(t *testing.T) {
SQLX: sqlx,
})
if ctx == nil {
t.Fatalf("NewContext returned nil")
t.Fatal(FOUND_NULL_CONTEXT_ERR_MSG)
}
select {
case x := <-ctx.Done():
Expand Down Expand Up @@ -152,7 +154,7 @@ func TestUpdateContext(t *testing.T) {
assert.NoError(t, err)

if ctx == nil {
t.Fatalf("NewContext returned nil")
t.Fatal(FOUND_NULL_CONTEXT_ERR_MSG)
}
select {
case x := <-ctx.Done():
Expand Down

0 comments on commit e60262a

Please sign in to comment.