-
Notifications
You must be signed in to change notification settings - Fork 46
/
meta.wlt
54 lines (49 loc) · 1.71 KB
/
meta.wlt
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<|
"meta" -> <|
"init" -> (
$testsDirectory = If[$TestFileName =!= "",
FileNameJoin[Most @ FileNameSplit @ $TestFileName]
,
FileNameJoin[Append[Most[FileNameSplit[$ScriptCommandLine[[1]]]], "Tests"]]
];
),
"tests" -> {
exports = Lookup[Package`PackageInformation["SetReplace`"], "PackageExports"];
(* All public symbols have usage message *)
hasNoSymbolUsageQ = Function[symbol,
Not @ StringQ @ MessageName[symbol, "usage"], HoldFirst];
VerificationTest[
Select[exports, hasNoSymbolUsageQ],
HoldComplete[]
],
(* All public symbols have syntax information *)
(* Additionally, SyntaxInformation should specify "OptionNames" if the symbol has Options. *)
hasSyntaxInformationQ = Function[
symbol,
Or[
StringStartsQ[SymbolName @ Unevaluated @ symbol, "$"],
And[
SyntaxInformation[Unevaluated @ symbol] =!= {},
Implies[
Options[Unevaluated @ symbol] =!= {},
ListQ[Lookup[SyntaxInformation[Unevaluated @ symbol], "OptionNames"]]]]],
HoldFirst];
VerificationTest[
Complement[exports, Select[exports, hasSyntaxInformationQ]],
HoldComplete[]
],
(* Test coverage: all public symbols appear in unit tests *)
allTestsCode = StringJoin[FileString /@ FileNames["*.wlt", $testsDirectory]];
doesNotAppearInTestsQ = Function[symbol,
!StringContainsQ[allTestsCode, SymbolName @ Unevaluated @ symbol],
HoldFirst];
VerificationTest[
Select[exports, doesNotAppearInTestsQ],
HoldComplete[]
]
},
"options" -> {
"Parallel" -> False
}
|>
|>