yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/esxi/utils_test.go (about)

     1  // Copyright 2019 Yunion
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package esxi
    16  
    17  import "testing"
    18  
    19  func TestInitValue(t *testing.T) {
    20  	type testStruct struct {
    21  		member1 int
    22  		member2 string
    23  		Member3 int
    24  		Member4 string
    25  	}
    26  
    27  	dst := testStruct{}
    28  
    29  	dst.member1 = 1
    30  	dst.member2 = "2"
    31  	dst.Member3 = 3
    32  	dst.Member4 = "4"
    33  
    34  	pDst := &dst
    35  	t.Logf("%p %#v", pDst, pDst)
    36  
    37  	*pDst = testStruct{}
    38  
    39  	t.Logf("%p %#v", pDst, pDst)
    40  
    41  	new := testStruct{}
    42  	if dst != new {
    43  		t.Errorf("dst != new")
    44  	}
    45  }