File: url_test.go

package info (click to toggle)
gron 0.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,740 kB
  • sloc: sh: 74; makefile: 17
file content (25 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main

import (
	"testing"
)

func TestValidURL(t *testing.T) {
	tests := []struct {
		url  string
		want bool
	}{
		{"http://test.com", true},
		{"https://test.com", true},
		{"HttPs://test.com", true},
		{"/test/test.com", false},
		{"", false},
	}

	for _, test := range tests {
		have := validURL(test.url)
		if have != test.want {
			t.Errorf("Want %t for validURL(%s); have %t", test.want, test.url, have)
		}
	}
}