video_test.go 781 B

123456789101112131415161718192021222324252627282930313233
  1. package archive
  2. import (
  3. "fmt"
  4. "testing"
  5. "time"
  6. )
  7. func Test_VideoEditor(t *testing.T) {
  8. edit := NewEditor(3)
  9. edit.Add(10,
  10. func() { fmt.Println("WOW!10 SUCCESS") },
  11. func() { fmt.Println("WOW!10 FAIL") },
  12. time.Duration(20*time.Second),
  13. []func() (int64, int, int, error){
  14. func() (int64, int, int, error) { return 10, 0, 1, nil },
  15. func() (int64, int, int, error) { return 10, 2, 3, fmt.Errorf("boom") },
  16. }...)
  17. edit.Add(11,
  18. func() { fmt.Println("WOW!11 SUCCESS") },
  19. func() { fmt.Println("WOW!11 FAIL") },
  20. time.Duration(5*time.Second),
  21. []func() (int64, int, int, error){
  22. func() (int64, int, int, error) { return 11, 0, 1, nil },
  23. func() (int64, int, int, error) { return 11, 0, 1, nil },
  24. }...)
  25. time.Sleep(time.Second)
  26. edit.Close()
  27. t.Fail()
  28. }