lang: Rename old fail5 and fail6 variables

Last of the numbered error scenario cleanups...
This commit is contained in:
James Shubin
2021-05-08 05:19:36 -04:00
parent a02d282d3e
commit e6408e187c
2 changed files with 23 additions and 23 deletions

View File

@@ -1004,8 +1004,8 @@ func TestAstFunc2(t *testing.T) {
const magicErrorSetScope = "errSetScope: " const magicErrorSetScope = "errSetScope: "
const magicErrorUnify = "errUnify: " const magicErrorUnify = "errUnify: "
const magicErrorGraph = "errGraph: " const magicErrorGraph = "errGraph: "
const magicError5 = "err5: " const magicErrorInterpret = "errInterpret: "
const magicError6 = "err6: " const magicErrorAutoEdge = "errAutoEdge: "
const magicEmpty = "# empty!" const magicEmpty = "# empty!"
dir, err := util.TestDirFull() dir, err := util.TestDirFull()
if err != nil { if err != nil {
@@ -1040,8 +1040,8 @@ func TestAstFunc2(t *testing.T) {
failSetScope bool failSetScope bool
failUnify bool failUnify bool
failGraph bool failGraph bool
fail5 bool failInterpret bool
fail6 bool failAutoEdge bool
} }
type test struct { // an individual test type test struct { // an individual test
name string name string
@@ -1100,8 +1100,8 @@ func TestAstFunc2(t *testing.T) {
failSetScope := false failSetScope := false
failUnify := false failUnify := false
failGraph := false failGraph := false
fail5 := false failInterpret := false
fail6 := false failAutoEdge := false
if strings.HasPrefix(str, magicError) { if strings.HasPrefix(str, magicError) {
errStr = strings.TrimPrefix(str, magicError) errStr = strings.TrimPrefix(str, magicError)
str = errStr str = errStr
@@ -1136,15 +1136,15 @@ func TestAstFunc2(t *testing.T) {
str = errStr str = errStr
failGraph = true failGraph = true
} }
if strings.HasPrefix(str, magicError5) { if strings.HasPrefix(str, magicErrorInterpret) {
errStr = strings.TrimPrefix(str, magicError5) errStr = strings.TrimPrefix(str, magicErrorInterpret)
str = errStr str = errStr
fail5 = true failInterpret = true
} }
if strings.HasPrefix(str, magicError6) { if strings.HasPrefix(str, magicErrorAutoEdge) {
errStr = strings.TrimPrefix(str, magicError6) errStr = strings.TrimPrefix(str, magicErrorAutoEdge)
str = errStr str = errStr
fail6 = true failAutoEdge = true
} }
} }
@@ -1161,8 +1161,8 @@ func TestAstFunc2(t *testing.T) {
failSetScope: failSetScope, failSetScope: failSetScope,
failUnify: failUnify, failUnify: failUnify,
failGraph: failGraph, failGraph: failGraph,
fail5: fail5, failInterpret: failInterpret,
fail6: fail6, failAutoEdge: failAutoEdge,
}, },
}) })
//t.Logf("adding: %s", f + "/") //t.Logf("adding: %s", f + "/")
@@ -1202,8 +1202,8 @@ func TestAstFunc2(t *testing.T) {
failSetScope := errs.failSetScope failSetScope := errs.failSetScope
failUnify := errs.failUnify failUnify := errs.failUnify
failGraph := errs.failGraph failGraph := errs.failGraph
fail5 := errs.fail5 failInterpret := errs.failInterpret
fail6 := errs.fail6 failAutoEdge := errs.failAutoEdge
t.Logf("\n\ntest #%d (%s) ----------------\npath: %s\n\n", index, name, src) t.Logf("\n\ntest #%d (%s) ----------------\npath: %s\n\n", index, name, src)
@@ -1537,12 +1537,12 @@ func TestAstFunc2(t *testing.T) {
ograph, err := interpret(iast) ograph, err := interpret(iast)
funcs.RUnlock() funcs.RUnlock()
if (!fail || !fail5) && err != nil { if (!fail || !failInterpret) && err != nil {
t.Errorf("test #%d: FAIL", index) t.Errorf("test #%d: FAIL", index)
t.Errorf("test #%d: interpret failed with: %+v", index, err) t.Errorf("test #%d: interpret failed with: %+v", index, err)
return return
} }
if fail5 && err != nil { // can't process graph if it's nil if failInterpret && err != nil { // can't process graph if it's nil
s := err.Error() // convert to string s := err.Error() // convert to string
if s != expstr { if s != expstr {
t.Errorf("test #%d: FAIL", index) t.Errorf("test #%d: FAIL", index)
@@ -1552,7 +1552,7 @@ func TestAstFunc2(t *testing.T) {
} }
return return
} }
if fail5 && err == nil { if failInterpret && err == nil {
t.Errorf("test #%d: FAIL", index) t.Errorf("test #%d: FAIL", index)
t.Errorf("test #%d: interpret passed, expected fail", index) t.Errorf("test #%d: interpret passed, expected fail", index)
return return
@@ -1560,12 +1560,12 @@ func TestAstFunc2(t *testing.T) {
// add automatic edges... // add automatic edges...
err = autoedge.AutoEdge(ograph, testing.Verbose(), logf) err = autoedge.AutoEdge(ograph, testing.Verbose(), logf)
if (!fail || !fail6) && err != nil { if (!fail || !failAutoEdge) && err != nil {
t.Errorf("test #%d: FAIL", index) t.Errorf("test #%d: FAIL", index)
t.Errorf("test #%d: automatic edges failed with: %+v", index, err) t.Errorf("test #%d: automatic edges failed with: %+v", index, err)
return return
} }
if fail6 && err != nil { if failAutoEdge && err != nil {
s := err.Error() // convert to string s := err.Error() // convert to string
if s != expstr { if s != expstr {
t.Errorf("test #%d: FAIL", index) t.Errorf("test #%d: FAIL", index)
@@ -1575,7 +1575,7 @@ func TestAstFunc2(t *testing.T) {
} }
return return
} }
if fail6 && err == nil { if failAutoEdge && err == nil {
t.Errorf("test #%d: FAIL", index) t.Errorf("test #%d: FAIL", index)
t.Errorf("test #%d: automatic edges passed, expected fail", index) t.Errorf("test #%d: automatic edges passed, expected fail", index)
return return

View File

@@ -1 +1 @@
# err: err5: resource: `file[/tmp/command-output]` has duplicate receive on: `content` param # err: errInterpret: resource: `file[/tmp/command-output]` has duplicate receive on: `content` param