diff options
| author | Jeff Carr <[email protected]> | 2025-01-09 16:18:06 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-09 16:18:06 -0600 |
| commit | 7c10ff958e57d02d13287c4cdbe0aca3781e1600 (patch) | |
| tree | 93d5071eb411b5c01b38b457d0cfd21559d4eaea /example/main.go | |
| parent | b1961c371da567692314f775f9bdcb95837d9278 (diff) | |
test unique insert failure
Diffstat (limited to 'example/main.go')
| -rw-r--r-- | example/main.go | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/example/main.go b/example/main.go index 47dad4f..6222701 100644 --- a/example/main.go +++ b/example/main.go @@ -3,7 +3,11 @@ package main -import "go.wit.com/log" +import ( + "os" + + "go.wit.com/log" +) // sent via -ldflags var VERSION string @@ -17,5 +21,21 @@ var pb *Fruits func main() { pb = NewFruits() - log.Info("did nothing yet", pb) + + fruit := &Fruit{ + Brand: "mom", + City: "New NewYork", + } + if pb.AppendUnique(fruit) { + log.Info("AppendUnique() ok") + } else { + log.Info("AppendUnique() failed") + os.Exit(-1) + } + if pb.AppendUnique(fruit) { + log.Info("AppendUnique() worked but should not have") + os.Exit(-1) + } else { + log.Info("AppendUnique() failed ok") + } } |
