github.com/hy3/cuto@v0.9.8-0.20160830082821-aa6652f877b7/util/syscall_windows_test.go (about) 1 // Copyright 2015 unirita Inc. 2 // Created 2015/04/10 shanxia 3 4 package util 5 6 import "testing" 7 8 func TestLoadDll_DLLロード成功(t *testing.T) { 9 dll := loadDLL("kernel32.dll") 10 if dll == nil { 11 t.Error("kernel32のロードに失敗しました。") 12 } 13 recover() 14 } 15 16 func TestFindProc_WinAPIを指定(t *testing.T) { 17 dll := loadDLL("kernel32.dll") 18 if dll == nil { 19 t.Fatal("DLLロード失敗。") 20 } 21 p := dll.findProc("GetVersion") 22 if p == nil { 23 t.Error("GetVersionInfo()のローディングに失敗しました。") 24 } 25 recover() 26 } 27 28 //func TestLoadDll_DLLロード失敗(t *testing.T) { 29 // dll := loadDLL("xxx.dll") 30 // if dll != nil { 31 // t.Error("成功するはずのないファイルがロードされました。") 32 // } 33 // recover() 34 //} 35 36 //func TestFindProc_存在しないWinAPIを指定(t *testing.T) { 37 // dll := loadDLL("kernel32.dll") 38 // if dll == nil { 39 // t.Fatal("DLLロード失敗。") 40 // } 41 // p := dll.findProc("a") 42 // if p != nil { 43 // t.Error("成功するはずのない処理が成功しました。") 44 // } 45 // recover() 46 //}