summaryrefslogtreecommitdiff
path: root/example/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'example/main.go')
-rw-r--r--example/main.go24
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")
+ }
}