| // Copyright 2018 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // This test requires a real binary to test and I don't want that binary |
| // to be uploaded into the repo at this time. I still want to show how |
| // to test such things. |
| |
| package elflib |
| |
| import ( |
| "os" |
| "testing" |
| ) |
| |
| func TestGetSoName(t *testing.T) { |
| f, err := os.Open("testdata/libc.so.debug") |
| if err != nil { |
| t.Fatal(err) |
| } |
| soname, err := GetSoName("testdata/libc.so.debug", f) |
| if err != nil { |
| t.Fatal(err) |
| } |
| if soname != "libc.so" { |
| t.Fatal("expected soname to be \"libc.so\" but got ", soname) |
| } |
| } |