github.com/hbdrawn/golang@v0.0.0-20141214014649-6b835209aba2/src/syscall/syscall_bsd_test.go (about)

     1  // Copyright 2014 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  // +build darwin dragonfly freebsd openbsd
     6  
     7  package syscall_test
     8  
     9  import (
    10  	"syscall"
    11  	"testing"
    12  )
    13  
    14  const MNT_WAIT = 1
    15  
    16  func TestGetfsstat(t *testing.T) {
    17  	n, err := syscall.Getfsstat(nil, MNT_WAIT)
    18  	if err != nil {
    19  		t.Fatal(err)
    20  	}
    21  
    22  	data := make([]syscall.Statfs_t, n)
    23  	n, err = syscall.Getfsstat(data, MNT_WAIT)
    24  	if err != nil {
    25  		t.Fatal(err)
    26  	}
    27  
    28  	empty := syscall.Statfs_t{}
    29  	for _, stat := range data {
    30  		if stat == empty {
    31  			t.Fatal("an empty Statfs_t struct was returned")
    32  		}
    33  	}
    34  }