github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/ci/testdata/tests/x_test.go (about)

     1  package tests
     2  
     3  import (
     4  	"os"
     5  	"syscall"
     6  	"testing"
     7  )
     8  
     9  func TestX(t *testing.T) {
    10  	t.Log("hallo")
    11  	info, err := os.Stat("../hello.txt")
    12  	if err != nil {
    13  		t.Fatal(err)
    14  	}
    15  	if info.IsDir() {
    16  		t.Fatal("hello.txt is a directory")
    17  	}
    18  	stat := info.Sys().(*syscall.Stat_t)
    19  	if int(stat.Uid) != os.Getuid() {
    20  		t.Errorf("hello.txt has owner %d, expected %d", stat.Uid, os.Getuid())
    21  	}
    22  	if int(stat.Gid) != os.Getgid() {
    23  		t.Errorf("hello.txt has group %d, expected %d", stat.Gid, os.Getgid())
    24  	}
    25  }