github.com/drone/go-convert@v0.0.0-20240307072510-6bd371c65e61/internal/slug/slug_test.go (about)

     1  // Copyright 2023 Harness Inc. All rights reserved.
     2  
     3  package slug
     4  
     5  import "testing"
     6  
     7  func TestSlug(t *testing.T) {
     8  	tests := []struct {
     9  		a, b string
    10  	}{
    11  		{"foo bar", "foobar"},
    12  		{"Foo Bar", "foobar"},
    13  		{"Foo-Bar", "foobar"},
    14  		{"Foo/Bar", "foobar"},
    15  	}
    16  	for _, test := range tests {
    17  		got, want := Create(test.a), test.b
    18  		if got != want {
    19  			t.Errorf("Want slug %q, got %q", want, got)
    20  		}
    21  	}
    22  }