github.com/HACKERALERT/Picocrypt/src/external/sys@v0.0.0-20210609020157-e519952f829f/unix/syscall_illumos_test.go (about)

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build illumos
     6  // +build illumos
     7  
     8  package unix_test
     9  
    10  import (
    11  	"testing"
    12  
    13  	"golang.org/x/sys/unix"
    14  )
    15  
    16  func TestLifreqSetName(t *testing.T) {
    17  	var l unix.Lifreq
    18  	err := l.SetName("12345678901234356789012345678901234567890")
    19  	if err == nil {
    20  		t.Fatal(`Lifreq.SetName should reject names that are too long`)
    21  	}
    22  	err = l.SetName("tun0")
    23  	if err != nil {
    24  		t.Errorf(`Lifreq.SetName("tun0") failed: %v`, err)
    25  	}
    26  }