oficina / estilo Public

Clone
git clone https://amadan.net/oficina/estilo

Plain git — no account needed to clone.

Download

Download this file

1package credits
2
3import (
4 "crypto/sha256"
5 "encoding/hex"
6 "encoding/json"
7 "os"
8 "testing"
9)
10
11func TestOnestNoticeMatchesRecordedProvenance(t *testing.T) {
12 raw, err := os.ReadFile("notices/onest-provenance.json")
13 if err != nil {
14 t.Fatal(err)
15 }
16 var record struct {
17 Source string `json:"source"`
18 SHA256 string `json:"sha256"`
19 Bytes int `json:"bytes"`
20 }
21 if err := json.Unmarshal(raw, &record); err != nil {
22 t.Fatal(err)
23 }
24 sum := sha256.Sum256([]byte(onestNotice))
25 if record.Source != "https://raw.githubusercontent.com/google/fonts/d0754ee7cddf8ba879f1f8884e3ca2b5e1b100f8/ofl/onest/OFL.txt" || record.Bytes != len(onestNotice) || record.SHA256 != hex.EncodeToString(sum[:]) {
26 t.Fatal("Onest notice differs from original provenance")
27 }
28}
29