options_test.go 580 B

1234567891011121314151617181920212223242526
  1. package micro
  2. import "testing"
  3. func TestOptions_ShortName(t *testing.T) {
  4. tests := []struct {
  5. name string
  6. o *Options
  7. want string
  8. }{
  9. {"package", &Options{Name: "git.nspix.com/golang/solar"}, "solar"},
  10. {"string", &Options{Name: "solar"}, "solar"},
  11. {"package", &Options{Name: "a.solar"}, "a.solar"},
  12. }
  13. for _, tt := range tests {
  14. t.Run(tt.name, func(t *testing.T) {
  15. if got := tt.o.ShortName(); got != tt.want {
  16. t.Errorf("Options.ShortName() = %v, want %v", got, tt.want)
  17. }
  18. })
  19. }
  20. }
  21. func TestMachineCode(t *testing.T) {
  22. defaultReporter.Do("test")
  23. }