Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Nghia Tran <[email protected]>
  • Loading branch information
tcnghia committed Jun 19, 2024
1 parent b8d2b35 commit f9da13c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,16 @@ func TestLoggerPC(t *testing.T) {
t.Errorf("want %v, got %v", want, got)
}
}

func TestWith(t *testing.T) {
ctx := context.WithValue(context.Background(), "test", "test")
log := NewLoggerWithContext(ctx, nil)
withed := log.With("a", "b")
if want := withed.ctx; want != ctx {
t.Errorf("want %v, got %v", want, ctx)
}
withed = log.WithGroup("a")
if want := withed.ctx; want != ctx {
t.Errorf("want %v, got %v", want, ctx)
}
}

0 comments on commit f9da13c

Please sign in to comment.