-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathdocs_test.go
More file actions
40 lines (32 loc) · 806 Bytes
/
docs_test.go
File metadata and controls
40 lines (32 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"testing"
_ "github.com/lmorg/murex/builtins"
"github.com/lmorg/murex/builtins/docs"
"github.com/lmorg/murex/lang"
"github.com/lmorg/murex/test/count"
)
func TestCoreDocs(t *testing.T) {
count.Tests(t, len(lang.GoFunctions)*3)
for name := range lang.GoFunctions {
syn, ok := docs.Synonym[name]
if ok && syn != "" {
goto passedSynTest
}
syn, ok = docs.Synonym["parser/"+name]
if !ok || syn == "" {
t.Errorf("Synonym for `%s` does not exist or is empty", name)
continue
}
passedSynTest:
sum, ok := docs.Summary[syn]
if !ok || sum == "" {
t.Errorf("Summary for `%s` does not exist or is empty", name)
continue
}
doc := docs.Definition(syn)
if len(doc) == 0 {
t.Errorf("document for `%s` does not exist or is empty", name)
}
}
}