(t *testing.T)
| 31 | } |
| 32 | |
| 33 | func TestCommandOptions(t *testing.T) { |
| 34 | logger := log.NewStdLogger(io.Discard, io.Discard) |
| 35 | dialer := &testDialer{} |
| 36 | tcs := []struct { |
| 37 | desc string |
| 38 | isValid func(*Command) error |
| 39 | option Option |
| 40 | skip bool |
| 41 | }{ |
| 42 | { |
| 43 | desc: "with logger", |
| 44 | isValid: func(c *Command) error { |
| 45 | if c.logger != logger { |
| 46 | return errors.New("loggers do not match") |
| 47 | } |
| 48 | return nil |
| 49 | }, |
| 50 | option: WithLogger(logger), |
| 51 | }, |
| 52 | { |
| 53 | desc: "with dialer", |
| 54 | isValid: func(c *Command) error { |
| 55 | if c.dialer != dialer { |
| 56 | return errors.New("dialers do not match") |
| 57 | } |
| 58 | return nil |
| 59 | }, |
| 60 | option: WithDialer(dialer), |
| 61 | }, |
| 62 | { |
| 63 | desc: "with FUSE dir", |
| 64 | isValid: func(c *Command) error { |
| 65 | if c.conf.FUSEDir != "somedir" { |
| 66 | return fmt.Errorf( |
| 67 | "want = %v, got = %v", "somedir", c.conf.FUSEDir, |
| 68 | ) |
| 69 | } |
| 70 | return nil |
| 71 | }, |
| 72 | option: WithFuseDir("somedir"), |
| 73 | // FUSE isn't available on GitHub macOS runners |
| 74 | // and FUSE isn't supported on Windows, so skip this test. |
| 75 | skip: runtime.GOOS == "darwin" || runtime.GOOS == "windows", |
| 76 | }, |
| 77 | { |
| 78 | desc: "with FUSE temp dir", |
| 79 | isValid: func(c *Command) error { |
| 80 | if c.conf.FUSETempDir != "somedir" { |
| 81 | return fmt.Errorf( |
| 82 | "want = %v, got = %v", "somedir", c.conf.FUSEDir, |
| 83 | ) |
| 84 | } |
| 85 | return nil |
| 86 | }, |
| 87 | option: WithFuseTempDir("somedir"), |
| 88 | // FUSE isn't available on GitHub macOS runners |
| 89 | // and FUSE isn't supported on Windows, so skip this test. |
| 90 | skip: runtime.GOOS == "darwin" || runtime.GOOS == "windows", |
nothing calls this directly
no test coverage detected