You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
599 B

  1. package svc
  2. type mockProgram struct {
  3. start func() error
  4. stop func() error
  5. init func(Environment) error
  6. }
  7. func (p *mockProgram) Start() error {
  8. return p.start()
  9. }
  10. func (p *mockProgram) Stop() error {
  11. return p.stop()
  12. }
  13. func (p *mockProgram) Init(wse Environment) error {
  14. return p.init(wse)
  15. }
  16. func makeProgram(startCalled, stopCalled, initCalled *int) *mockProgram {
  17. return &mockProgram{
  18. start: func() error {
  19. *startCalled++
  20. return nil
  21. },
  22. stop: func() error {
  23. *stopCalled++
  24. return nil
  25. },
  26. init: func(wse Environment) error {
  27. *initCalled++
  28. return nil
  29. },
  30. }
  31. }