(t *testing.T)
| 1600 | } |
| 1601 | |
| 1602 | func Test_openUserFile(t *testing.T) { |
| 1603 | f, err := os.CreateTemp(t.TempDir(), "gh-test") |
| 1604 | if err != nil { |
| 1605 | t.Fatal(err) |
| 1606 | } |
| 1607 | defer f.Close() |
| 1608 | |
| 1609 | fmt.Fprint(f, "file contents") |
| 1610 | |
| 1611 | file, length, err := openUserFile(f.Name(), nil) |
| 1612 | if err != nil { |
| 1613 | t.Fatal(err) |
| 1614 | } |
| 1615 | defer file.Close() |
| 1616 | |
| 1617 | fb, err := io.ReadAll(file) |
| 1618 | if err != nil { |
| 1619 | t.Fatal(err) |
| 1620 | } |
| 1621 | |
| 1622 | assert.Equal(t, int64(13), length) |
| 1623 | assert.Equal(t, "file contents", string(fb)) |
| 1624 | } |
| 1625 | |
| 1626 | func Test_fillPlaceholders(t *testing.T) { |
| 1627 | type args struct { |
nothing calls this directly
no test coverage detected