github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/communicator/shared/shared_test.go (about)

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