github.com/hs0210/hashicorp-terraform@v0.11.12-beta1/communicator/shared/shared_test.go (about)

     1  package shared
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestIpFormatting_Ipv4(t *testing.T) {
     8  	formatted := IpFormat("127.0.0.1")
     9  	if formatted != "127.0.0.1" {
    10  		t.Fatal("expected", "127.0.0.1", "got", formatted)
    11  	}
    12  }
    13  
    14  func TestIpFormatting_Hostname(t *testing.T) {
    15  	formatted := IpFormat("example.com")
    16  	if formatted != "example.com" {
    17  		t.Fatal("expected", "example.com", "got", formatted)
    18  	}
    19  }
    20  
    21  func TestIpFormatting_Ipv6(t *testing.T) {
    22  	formatted := IpFormat("::1")
    23  	if formatted != "[::1]" {
    24  		t.Fatal("expected", "[::1]", "got", formatted)
    25  	}
    26  }