test unique insert failure
This commit is contained in:
parent
b1961c371d
commit
7c10ff958e
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
15
newsort.go
15
newsort.go
|
@ -21,21 +21,8 @@ func (pb *Files) makeNewSortfile(pf *File) error {
|
|||
|
||||
pf.Base.iterTop(f)
|
||||
pf.Base.iterNext(f)
|
||||
pf.appendUnique(f) // Append() enforce no unique keys
|
||||
|
||||
/*
|
||||
for _, msg := range pf.MsgNames {
|
||||
if msg.DoMutex {
|
||||
for _, key := range msg.Sort {
|
||||
pf.iterTop(f, key)
|
||||
pf.iterNext(f, key)
|
||||
}
|
||||
} else {
|
||||
log.Info("Skipping syncLock() for", msg.Name, "DoMutex = false")
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
pf.appendUnique(f, nil, sortmap) // Append() enforce no unique keys
|
||||
return nil
|
||||
// iterSortAll(f, sortmap)
|
||||
|
||||
|
|
4
sort.go
4
sort.go
|
@ -185,9 +185,9 @@ func iterEnd(w io.Writer, names map[string]string) {
|
|||
func iterAppend(w io.Writer, names map[string]string) {
|
||||
}
|
||||
|
||||
func (pf *File) appendUnique(w io.Writer, blah *MsgName, names map[string]string) {
|
||||
func (pf *File) appendUnique(w io.Writer) {
|
||||
var MSG string = pf.Bases.Name
|
||||
var BASE string = names["Base"]
|
||||
var BASE string = pf.Base.Name
|
||||
var LOCK string = pf.Bases.Lockname
|
||||
|
||||
if argv.Mutex {
|
||||
|
|
Loading…
Reference in New Issue