(t *testing.T, m *testModel, expected []string)
| 1496 | } |
| 1497 | |
| 1498 | func changeIgnores(t *testing.T, m *testModel, expected []string) { |
| 1499 | arrEqual := func(a, b []string) bool { |
| 1500 | if len(a) != len(b) { |
| 1501 | return false |
| 1502 | } |
| 1503 | |
| 1504 | for i := range a { |
| 1505 | if a[i] != b[i] { |
| 1506 | return false |
| 1507 | } |
| 1508 | } |
| 1509 | return true |
| 1510 | } |
| 1511 | |
| 1512 | ignores, _, err := m.LoadIgnores("default") |
| 1513 | if err != nil { |
| 1514 | t.Error(err) |
| 1515 | } |
| 1516 | |
| 1517 | if !arrEqual(ignores, expected) { |
| 1518 | t.Errorf("Incorrect ignores: %v != %v", ignores, expected) |
| 1519 | } |
| 1520 | |
| 1521 | ignores = append(ignores, "pox") |
| 1522 | |
| 1523 | err = m.SetIgnores("default", ignores) |
| 1524 | if err != nil { |
| 1525 | t.Error(err) |
| 1526 | } |
| 1527 | |
| 1528 | ignores2, _, err := m.LoadIgnores("default") |
| 1529 | if err != nil { |
| 1530 | t.Error(err) |
| 1531 | } |
| 1532 | |
| 1533 | if !arrEqual(ignores, ignores2) { |
| 1534 | t.Errorf("Incorrect ignores: %v != %v", ignores2, ignores) |
| 1535 | } |
| 1536 | |
| 1537 | if build.IsDarwin { |
| 1538 | // see above |
| 1539 | time.Sleep(time.Second) |
| 1540 | } else { |
| 1541 | time.Sleep(time.Millisecond) |
| 1542 | } |
| 1543 | err = m.SetIgnores("default", expected) |
| 1544 | if err != nil { |
| 1545 | t.Error(err) |
| 1546 | } |
| 1547 | |
| 1548 | ignores, _, err = m.LoadIgnores("default") |
| 1549 | if err != nil { |
| 1550 | t.Error(err) |
| 1551 | } |
| 1552 | |
| 1553 | if !arrEqual(ignores, expected) { |
| 1554 | t.Errorf("Incorrect ignores: %v != %v", ignores, expected) |
| 1555 | } |
no test coverage detected