Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/platform/orgsettings/source_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/platform/orgsettings/source_test.go |
| Original SHA-256 | 81ebbe989b5c7afdb8974facf1952628d6544e2f0734a26a9c56ceda386802b6 |
| Git blob SHA | caac858b71f32b18e6b9ae1abe715bc49cadf4ed |
| Reading-copy SHA-256 | 81ebbe989b5c7afdb8974facf1952628d6544e2f0734a26a9c56ceda386802b6 |
Recovered source transcript
Download complete source text ↓47 lines · 1.2 KB
package orgsettings
import (
"os"
"strings"
"testing"
)
// Small helpers for the structural tests. They read this package's own source, which is the right tool for a
// defect that lives in a SQL string rather than in behaviour a unit test can reach without a database.
func readSource(t *testing.T, name string) string {
t.Helper()
b, err := os.ReadFile(name)
if err != nil {
t.Fatalf("read %s: %v", name, err)
}
return string(b)
}
func contains(s, sub string) bool { return strings.Contains(s, sub) }
func containsAll(s string, subs ...string) bool {
for _, sub := range subs {
if !strings.Contains(s, sub) {
return false
}
}
return true
}
// functionBody returns the text from a function's signature to the next line that begins a new top level
// declaration. Crude, and sufficient: it only has to bound one function well enough to look inside it.
func functionBody(src, signature string) string {
i := strings.Index(src, signature)
if i < 0 {
return ""
}
rest := src[i+len(signature):]
// The next top level func starts at a line beginning with "func ", which cannot occur inside a body at
// column zero in gofmt output.
if j := strings.Index(rest, "\nfunc "); j >= 0 {
return rest[:j]
}
return rest
}