Commits

Miki Tebeka  committed 7082e3b

simler logic with continue

  • Participants
  • Parent commits 235f664
  • Branches dev

Comments (0)

Files changed (1)

 			suiteName = tokens[1]
 			test = &Test{Name: tokens[2]}
 			out = []string{}
-		} else {
-			tokens := find_end(line)
-			if len(tokens) > 0 {
-				if test == nil {
-					return nil, fmt.Errorf("%d: orphan end", lnum)
-				}
-				if (tokens[2] != suiteName) || (tokens[3] != test.Name) {
-					return nil, fmt.Errorf("%d: suite/name mismatch", lnum)
-				}
-				test.Message = strings.Join(out, "\n")
-				test.Time = tokens[4]
-				test.Failed = (tokens[1] == "FAIL")
+			continue
+		}
 
-				suite, ok := suites[suiteName]
-				if !ok {
-					suite = &Suite{Name:suiteName}
-				}
-				suite.Tests = append(suite.Tests, test)
-				suites[suiteName] = suite
+		tokens = find_end(line)
+		if len(tokens) > 0 {
+			if test == nil {
+				return nil, fmt.Errorf("%d: orphan end", lnum)
+			}
+			if (tokens[2] != suiteName) || (tokens[3] != test.Name) {
+				return nil, fmt.Errorf("%d: suite/name mismatch", lnum)
+			}
+			test.Message = strings.Join(out, "\n")
+			test.Time = tokens[4]
+			test.Failed = (tokens[1] == "FAIL")
 
-				test = nil
-				suiteName = ""
-				out = []string{}
+			suite, ok := suites[suiteName]
+			if !ok {
+				suite = &Suite{Name:suiteName}
+			}
+			suite.Tests = append(suite.Tests, test)
+			suites[suiteName] = suite
 
-			} else { // No start or end
-				if test != nil {
-					out = append(out, line)
-				}
-			}
+			test = nil
+			suiteName = ""
+			out = []string{}
+
+			continue
+		}
+
+		if test != nil {
+			out = append(out, line)
 		}
 	}