datasource_plugin_test.go 631 B

1234567891011121314151617181920212223242526272829303132333435
  1. package plugins
  2. import (
  3. "testing"
  4. )
  5. func TestComposeBinaryName(t *testing.T) {
  6. tests := []struct {
  7. name string
  8. os string
  9. arch string
  10. expectedPath string
  11. }{
  12. {
  13. name: "simple-json",
  14. os: "linux",
  15. arch: "amd64",
  16. expectedPath: `simple-json_linux_amd64`,
  17. },
  18. {
  19. name: "simple-json",
  20. os: "windows",
  21. arch: "amd64",
  22. expectedPath: `simple-json_windows_amd64.exe`,
  23. },
  24. }
  25. for _, v := range tests {
  26. have := composeBinaryName(v.name, v.os, v.arch)
  27. if have != v.expectedPath {
  28. t.Errorf("expected %s got %s", v.expectedPath, have)
  29. }
  30. }
  31. }