-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMemoryHoleTesting.ns
More file actions
94 lines (87 loc) · 3.03 KB
/
Copy pathMemoryHoleTesting.ns
File metadata and controls
94 lines (87 loc) · 3.03 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Newspeak3
'Newspeak'
class MemoryHoleTesting usingPlatform: platform vcs: vcs testFramework: minitest = Object new (
(* Smoke tests for the web port of MemoryHole.
Phase 1 verifies that the ported modules — VCSCore, VCSDiffing,
VCSSourceMirrors — load against a minimal IDE stub (their slot
blocks resolve without raising). No actual VCS operations are
exercised here; those are covered by the live IDE flow.
The vcs argument is the result of VCSLib usingPlatform: platform
ide: ideStub, built by the test configuration. If that call
succeeds, every nested module already loaded — the simultaneous
slot block at VCS-instantiation time forces all four sub-module
factories. Tests below then probe the public surface to make sure
nothing is nil-by-mistake. *)
|
private TestContext = minitest TestContext.
private Platform = platform.
private VCS = vcs.
|
) (
public class ModuleLoadTests new = TestContext new (
(* Each VCS public accessor returns a real (non-nil) module instance.
If any slot init had raised during VCS construction, we'd have
caught it in the test configuration's testModulesUsingPlatform:
build and the runner would never reach these tests. *)
) (
public testVCSIsNotNil = (
deny: VCS isNil
)
public testCoreLoaded = (
deny: VCS core isNil
)
public testDiffingLoaded = (
deny: VCS diffing isNil
)
public testSourceMirrorsLoaded = (
deny: VCS sourceMirrors isNil
)
public testCoreLogger = (
(* Logger is instantiated in VCSCore's module body. Verifies the
Monitor-slot drop in Logger didn't break Logger construction. *)
deny: VCS core logger isNil
)
) : (
TEST_CONTEXT = (
)
)
public class SourceMirrorParserTests new = TestContext new (
(* Force the lazy parser-cache slots in VCSSourceMirrors. Each
access exercises:
- MirrorCache onSelector: (the slot initializer)
- imageMirrorCache stringToMirrorCacheForProduction: (slot block of
MirrorCache) — validates the InMemoryMirrorCache substitute.
- SourceMirrorParser new (also slot block of MirrorCache) — which
inherits from TypedNS3Grammar, validating that ide grammar gives
us a real grammar class. *)
) (
public testCompilationUnitCacheLoaded = (
deny: VCS sourceMirrors compilationUnitCache isNil
)
public testMethodDeclCacheLoaded = (
deny: VCS sourceMirrors methodDeclCache isNil
)
public testParseMinimalToplevelClass = (
(* Round-trip a minimal Newspeak compilation unit through the
compilationUnitCache. Verifies that ide grammar TypedNS3Grammar
yields a real grammar (SourceMirrorParser inherits from it),
that the InMemoryMirrorCache memoizes correctly, and that the
wrappers in SourceMirrorParser produce a ClassSourceMirror with
the expected name and category. *)
| source mirror |
source:: 'Newspeak3
''Root''
class Foo = (
) (
) : (
)'.
mirror:: VCS sourceMirrors mirrorForString: source.
deny: mirror isNil.
assert: mirror name equals: #Foo.
assert: mirror category equals: 'Root'
)
) : (
TEST_CONTEXT = (
)
)
) : ()