Function to load theme code

This commit is contained in:
Kovid Goyal
2023-02-26 22:09:07 +05:30
parent 22150e13fd
commit c1791c8d2b
2 changed files with 54 additions and 15 deletions

View File

@@ -136,4 +136,22 @@ func TestThemeCollections(t *testing.T) {
if after2.ModTime() != after.ModTime() {
t.Fatal("Cached zip file was incorrectly not re-downloaded")
}
coll := Themes{name_map: map[string]*Theme{}}
closer, err := coll.add_from_zip_file(filepath.Join(tdir, "test.zip"))
if err != nil {
t.Fatal(err)
}
defer closer.Close()
if code, err := coll.ThemeByName("Empty").Code(); code != "empty" {
if err != nil {
t.Fatal(err)
}
t.Fatal("failed to load code for empty theme")
}
if code, err := coll.ThemeByName("Alabaster Dark").Code(); code != "alabaster" {
if err != nil {
t.Fatal(err)
}
t.Fatal("failed to load code for alabaster theme")
}
}