github.com/zmap/zlint@v1.1.0/util/gtld_test.go (about)

     1  /*
     2   * ZLint Copyright 2018 Regents of the University of Michigan
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
     5   * use this file except in compliance with the License. You may obtain a copy
     6   * of the License at http://www.apache.org/licenses/LICENSE-2.0
     7   *
     8   * Unless required by applicable law or agreed to in writing, software
     9   * distributed under the License is distributed on an "AS IS" BASIS,
    10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
    11   * implied. See the License for the specific language governing
    12   * permissions and limitations under the License.
    13   */
    14  
    15  package util
    16  
    17  import (
    18  	"testing"
    19  	"time"
    20  )
    21  
    22  func TestHasValidTLD(t *testing.T) {
    23  	domain := "google.com"
    24  	expected := true
    25  	actual := HasValidTLD(domain, time.Now())
    26  	if expected != actual {
    27  		t.Error(
    28  			"For", domain,
    29  			"expected", expected,
    30  			"got", actual,
    31  		)
    32  	}
    33  }
    34  
    35  func TestHasValidTLDUppercaseName(t *testing.T) {
    36  	domain := "GOOGLE.COM"
    37  	expected := true
    38  	actual := HasValidTLD(domain, time.Now())
    39  	if expected != actual {
    40  		t.Error(
    41  			"For", domain,
    42  			"expected", expected,
    43  			"got", actual,
    44  		)
    45  	}
    46  }