(t *testing.T)
| 21 | ) |
| 22 | |
| 23 | func TestValidateURI(t *testing.T) { |
| 24 | |
| 25 | tests := []struct { |
| 26 | name string |
| 27 | uri string |
| 28 | wantErr bool |
| 29 | }{ |
| 30 | { |
| 31 | name: "Valid URI format starts with http", |
| 32 | uri: "http://devfile.yaml", |
| 33 | wantErr: false, |
| 34 | }, |
| 35 | { |
| 36 | name: "Invalid URI format starts with http", |
| 37 | uri: "http//devfile.yaml", |
| 38 | wantErr: true, |
| 39 | }, |
| 40 | { |
| 41 | name: "Valid URI format does not start with http", |
| 42 | uri: "./devfile.yaml", |
| 43 | wantErr: false, |
| 44 | }, |
| 45 | } |
| 46 | for _, tt := range tests { |
| 47 | t.Run(tt.name, func(t *testing.T) { |
| 48 | err := ValidateURI(tt.uri) |
| 49 | if err != nil && !tt.wantErr { |
| 50 | t.Errorf("TestValidateURI error: %v", err) |
| 51 | } |
| 52 | }) |
| 53 | } |
| 54 | } |
nothing calls this directly
no test coverage detected