flok 0.0.40 → 0.0.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/drivers/chrome/src/dispatch.js +7 -2
- data/app/kern/dispatch.js +10 -1
- data/app/kern/mod/event.js +9 -0
- data/app/kern/pagers/pg_mem.js +21 -0
- data/app/kern/pagers/pg_net_sim.js +44 -0
- data/app/kern/pagers/pg_spec.js +23 -0
- data/app/kern/services/vm.rb +60 -64
- data/bin/flok +44 -23
- data/docs/callout.md +1 -1
- data/docs/client_api.md +5 -2
- data/docs/config_yml.md +41 -0
- data/docs/controllers.md +4 -0
- data/docs/datatypes.md +5 -2
- data/docs/debug_server.md +2 -0
- data/docs/dispatch.md +8 -3
- data/docs/known_issues.md +6 -0
- data/docs/mod/event.md +25 -20
- data/docs/mod/persist.md +1 -1
- data/docs/mod/speech.md +12 -0
- data/docs/project.md +2 -2
- data/docs/services/vm.md +46 -17
- data/docs/services/vm/pagers.md +22 -2
- data/lib/flok/build.rb +0 -4
- data/lib/flok/user_compiler.rb +123 -47
- data/lib/flok/user_compiler_templates/ctable.js.erb +39 -1
- data/lib/flok/version.rb +1 -1
- data/spec/env/global.rb +1 -0
- data/spec/env/kern.rb +5 -1
- data/spec/etc/cli_spec.rb +337 -322
- data/spec/etc/service_compiler/config0.rb +1 -1
- data/spec/etc/service_compiler/config0b.rb +1 -0
- data/spec/etc/services_compiler_spec.rb +29 -29
- data/spec/etc/user_compiler/controller0b.rb +9 -0
- data/spec/etc/user_compiler/controller0timer.rb +16 -0
- data/spec/etc/user_compiler_spec.rb +24 -1
- data/spec/iface/driver/dispatch_spec.rb +8 -2
- data/spec/iface/driver/persist_spec.rb +11 -0
- data/spec/kern/assets/controller0defer.rb +18 -0
- data/spec/kern/assets/controller0defer0.rb +13 -0
- data/spec/kern/assets/controller0defer2.rb +17 -0
- data/spec/kern/assets/global_on_entry.rb +8 -0
- data/spec/kern/assets/global_on_entry2.rb +16 -0
- data/spec/kern/assets/global_on_entry3.rb +17 -0
- data/spec/kern/assets/global_on_entry4.rb +12 -0
- data/spec/kern/assets/interval.rb +29 -0
- data/spec/kern/assets/interval2.rb +33 -0
- data/spec/kern/assets/interval3.rb +39 -0
- data/spec/kern/assets/service1.rb +4 -1
- data/spec/kern/assets/service_controller1.rb +11 -0
- data/spec/kern/assets/specimin/controller0.rb +74 -0
- data/spec/kern/assets/vm/config5.rb +20 -0
- data/spec/kern/assets/vm/config6.rb +20 -0
- data/spec/kern/assets/vm/controller10.rb +1 -1
- data/spec/kern/assets/vm/controller11.rb +1 -1
- data/spec/kern/assets/vm/controller12.rb +1 -1
- data/spec/kern/assets/vm/controller13.rb +1 -1
- data/spec/kern/assets/vm/controller16b.rb +28 -0
- data/spec/kern/assets/vm/controller18.rb +1 -1
- data/spec/kern/assets/vm/controller21.rb +1 -1
- data/spec/kern/assets/vm/controller22.rb +8 -0
- data/spec/kern/assets/vm/controller_exc_ewatch.rb +1 -0
- data/spec/kern/assets/vm/controller_exc_ewatch2.rb +30 -0
- data/spec/kern/assets/vm/controller_exc_ewatch3.rb +16 -0
- data/spec/kern/assets/vm/controller_exc_ewatch4.rb +16 -0
- data/spec/kern/assets/vm/macros/copy_page_c.rb +1 -0
- data/spec/kern/assets/vm/macros/copy_page_ch.rb +25 -0
- data/spec/kern/assets/vm/macros/entry_del_c.rb +1 -0
- data/spec/kern/assets/vm/macros/entry_del_ch.rb +20 -0
- data/spec/kern/assets/vm/macros/entry_insert_c.rb +1 -0
- data/spec/kern/assets/vm/macros/entry_insert_ch.rb +23 -0
- data/spec/kern/assets/vm/macros/entry_mutable_c.rb +8 -7
- data/spec/kern/assets/vm/macros/entry_mutable_ch.rb +34 -0
- data/spec/kern/assets/vm/macros/new_page_c.rb +1 -1
- data/spec/kern/assets/vm/macros/new_page_c2.rb +1 -1
- data/spec/kern/assets/vm/macros/new_page_ch.rb +7 -0
- data/spec/kern/assets/vm/pg_mem/config.rb +10 -0
- data/spec/kern/assets/vm/pg_mem/config1.rb +10 -0
- data/spec/kern/assets/vm/pg_mem/config2.rb +10 -0
- data/spec/kern/assets/vm/pg_mem/config3.rb +15 -0
- data/spec/kern/assets/vm/pg_mem/write.rb +23 -0
- data/spec/kern/assets/vm/pg_mem/write2.rb +38 -0
- data/spec/kern/assets/vm/pg_net_sim/config.rb +10 -0
- data/spec/kern/assets/vm/pg_net_sim/nothing.rb +12 -0
- data/spec/kern/assets/vm/pg_net_sim/pages.json +1 -0
- data/spec/kern/assets/vm/pg_net_sim/watch.rb +18 -0
- data/spec/kern/callout_spec.rb +1 -1
- data/spec/kern/controller_macro_spec.rb +153 -20
- data/spec/kern/controller_spec.rb +232 -1
- data/spec/kern/debug_ui_spec.rb +235 -235
- data/spec/kern/event_spec.rb +112 -0
- data/spec/kern/service_controller_spec.rb +14 -2
- data/spec/kern/vm_service_mem_pagers_spec.rb +117 -0
- data/spec/kern/vm_service_net_sim_pager_spec.rb +97 -0
- data/spec/kern/vm_service_spec.rb +304 -17
- data/spec/kern/vm_service_spec2.rb +39 -0
- metadata +88 -6
- data/app/kern/pagers/mem_pager.js +0 -2
- data/app/kern/pagers/pg_spec0.js +0 -20
- data/lib/flok/project_template/Guardfile +0 -7
- data/lib/flok/project_template/config/config.yml +0 -1
data/spec/kern/debug_ui_spec.rb
CHANGED
@@ -9,241 +9,241 @@ require './spec/lib/rspec_extensions.rb'
|
|
9
9
|
RSpec.describe "kern:debug_ui_spec" do
|
10
10
|
include_context "kern"
|
11
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
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
12
|
+
it "Can call int_debug_dump_ui and get back root view hierarchy" do
|
13
|
+
#Compile the controller
|
14
|
+
ctx = flok_new_user File.read('./spec/kern/assets/controller_bare.rb')
|
15
|
+
|
16
|
+
#Do not run anything
|
17
|
+
ctx.eval %{
|
18
|
+
int_dispatch([]);
|
19
|
+
}
|
20
|
+
|
21
|
+
@driver.int "int_debug_dump_ui", []
|
22
|
+
|
23
|
+
@driver.mexpect("if_event", [-333, "debug_dump_ui_res", {
|
24
|
+
"type" => "spot",
|
25
|
+
"name" => "root",
|
26
|
+
"ptr" => 0,
|
27
|
+
"children" => []
|
28
|
+
}])
|
29
|
+
end
|
30
|
+
|
31
|
+
it "Can call int_debug_dump_ui for one controller correctly" do
|
32
|
+
#Compile the controller
|
33
|
+
ctx = flok_new_user File.read('./spec/kern/assets/controller_bare.rb')
|
34
|
+
|
35
|
+
#Do not run anything
|
36
|
+
ctx.eval %{
|
37
|
+
//Call embed on main root view
|
38
|
+
base = _embed("my_controller", 0, {}, null);
|
39
|
+
|
40
|
+
//Drain queue
|
41
|
+
int_dispatch([]);
|
42
|
+
}
|
43
|
+
|
44
|
+
base = ctx.eval("base")
|
45
|
+
|
46
|
+
@driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main"]])
|
47
|
+
@driver.mexpect("if_controller_init", [base, base+1, "my_controller", {}])
|
48
|
+
@driver.mexpect("if_attach_view", [base+1, 0])
|
49
|
+
@driver.mexpect("if_event", [base, "action", {"from" => nil, "to" => "index"}])
|
50
|
+
|
51
|
+
@driver.int "int_debug_dump_ui", []
|
52
|
+
@driver.mexpect("if_event", [-333, "debug_dump_ui_res", {
|
53
|
+
"type" => "spot",
|
54
|
+
"name" => "root",
|
55
|
+
"ptr" => 0,
|
56
|
+
"children" => [
|
57
|
+
{
|
58
|
+
"name" => "my_controller",
|
59
|
+
"ptr" => base,
|
60
|
+
"type" => "vc",
|
61
|
+
"action" => "index",
|
62
|
+
"events" => ["test"],
|
63
|
+
"children" => [
|
64
|
+
{
|
65
|
+
"type" => "view",
|
66
|
+
"name" => "my_controller",
|
67
|
+
"ptr" => base+1,
|
68
|
+
"children" => []
|
69
|
+
}
|
70
|
+
]
|
71
|
+
}
|
72
|
+
]
|
73
|
+
}])
|
74
|
+
end
|
75
|
+
|
76
|
+
it "Can call int_debug_dump_ui for one controller correctly with spots" do
|
77
|
+
#Compile the controller
|
78
|
+
ctx = flok_new_user File.read('./spec/kern/assets/controller_spots.rb')
|
79
|
+
|
80
|
+
#Do not run anything
|
81
|
+
ctx.eval %{
|
82
|
+
//Call embed on main root view
|
83
|
+
base = _embed("my_controller", 0, {}, null);
|
84
|
+
|
85
|
+
//Drain queue
|
86
|
+
int_dispatch([]);
|
87
|
+
}
|
88
|
+
|
89
|
+
base = ctx.eval("base")
|
90
|
+
|
91
|
+
@driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main", "one", "two"]])
|
92
|
+
@driver.mexpect("if_controller_init", [base, base+1, "my_controller", {}])
|
93
|
+
@driver.mexpect("if_attach_view", [base+1, 0])
|
94
|
+
@driver.mexpect("if_event", [base, "action", {"from" => nil, "to" => "index"}])
|
95
|
+
|
96
|
+
@driver.int "int_debug_dump_ui", []
|
97
|
+
@driver.mexpect("if_event", [-333, "debug_dump_ui_res", {
|
98
|
+
"type" => "spot",
|
99
|
+
"name" => "root",
|
100
|
+
"ptr" => 0,
|
101
|
+
"children" => [
|
102
|
+
{
|
103
|
+
"name" => "my_controller",
|
104
|
+
"ptr" => base,
|
105
|
+
"type" => "vc",
|
106
|
+
"action" => "index",
|
107
|
+
"events" => ["test", "test2"],
|
108
|
+
"children" => [
|
109
|
+
{
|
110
|
+
"type" => "view",
|
111
|
+
"name" => "my_controller",
|
112
|
+
"ptr" => base+1,
|
113
|
+
"children" => [
|
114
|
+
{"name" => "one", "type" => "spot", "children" => [], "ptr" => base+2},
|
115
|
+
{"name" => "two", "type" => "spot", "children" => [], "ptr" => base+3},
|
116
|
+
]
|
117
|
+
}
|
118
|
+
]
|
119
|
+
}
|
120
|
+
]
|
121
|
+
}])
|
122
|
+
end
|
123
|
+
|
124
|
+
it "Can call int_debug_dump_ui for one controller correctly with spots and one embedded" do
|
125
|
+
#Compile the controller
|
126
|
+
ctx = flok_new_user File.read('./spec/kern/assets/controller_spots_embed.rb')
|
127
|
+
|
128
|
+
#Do not run anything
|
129
|
+
ctx.eval %{
|
130
|
+
//Call embed on main root view
|
131
|
+
base = _embed("my_controller", 0, {}, null);
|
132
|
+
|
133
|
+
//Drain queue
|
134
|
+
int_dispatch([]);
|
135
|
+
}
|
136
|
+
|
137
|
+
base = ctx.eval("base")
|
138
|
+
|
139
|
+
@driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main", "one", "two"]])
|
140
|
+
@driver.mexpect("if_controller_init", [base, base+1, "my_controller", {}])
|
141
|
+
@driver.mexpect("if_attach_view", [base+1, 0])
|
142
|
+
@driver.mexpect("if_init_view", ["my_other_controller", {}, base+5, ["main"]])
|
143
|
+
@driver.mexpect("if_controller_init", [base+4, base+5, "my_other_controller", {}])
|
144
|
+
@driver.mexpect("if_attach_view", [base+5, base+2])
|
145
|
+
@driver.mexpect("if_event", [base+4, "action", {"from" => nil, "to" => "index"}])
|
146
|
+
@driver.mexpect("if_event", [base, "action", {"from" => nil, "to" => "index"}])
|
147
|
+
|
148
|
+
@driver.int "int_debug_dump_ui", []
|
149
|
+
@driver.mexpect("if_event", [-333, "debug_dump_ui_res", {
|
150
|
+
"type" => "spot",
|
151
|
+
"name" => "root",
|
152
|
+
"ptr" => 0,
|
153
|
+
"children" => [
|
154
|
+
{
|
155
|
+
"name" => "my_controller",
|
156
|
+
"ptr" => base,
|
157
|
+
"type" => "vc",
|
158
|
+
"action" => "index",
|
159
|
+
"events" => ["test1"],
|
160
|
+
"children" => [
|
161
|
+
{
|
162
|
+
"type" => "view",
|
163
|
+
"name" => "my_controller",
|
164
|
+
"ptr" => base+1,
|
165
|
+
"children" => [
|
166
|
+
{"name" => "one", "type" => "spot", "children" => [
|
167
|
+
{
|
168
|
+
"name" => "my_other_controller",
|
169
|
+
"ptr" => base+4,
|
170
|
+
"type" => "vc",
|
171
|
+
"action" => "index",
|
172
|
+
"events" => ["test2"],
|
173
|
+
"children" => [
|
174
|
+
{
|
175
|
+
"type" => "view",
|
176
|
+
"ptr" => base+5,
|
177
|
+
"name" => "my_other_controller",
|
178
|
+
"children" => [],
|
179
|
+
}
|
180
|
+
]
|
181
|
+
}
|
182
|
+
], "ptr" => base+2},
|
183
|
+
{"name" => "two", "type" => "spot", "children" => [], "ptr" => base+3},
|
184
|
+
]
|
185
|
+
}
|
186
|
+
]
|
187
|
+
}
|
188
|
+
]
|
189
|
+
}])
|
190
|
+
end
|
191
|
+
|
192
|
+
it "Can call int_debug_dump_ui for one controller correctly with spots and one embedded that was later removed" do
|
193
|
+
#Compile the controller
|
194
|
+
ctx = flok_new_user File.read('./spec/kern/assets/controller_spots_embed_removed.rb')
|
195
|
+
|
196
|
+
#Do not run anything
|
197
|
+
ctx.eval %{
|
198
|
+
//Call embed on main root view
|
199
|
+
base = _embed("my_controller", 0, {}, null);
|
200
|
+
|
201
|
+
//Drain queue
|
202
|
+
int_dispatch([3, "int_event", base, "next", {}]);
|
203
|
+
}
|
204
|
+
|
205
|
+
base = ctx.eval("base")
|
206
|
+
|
207
|
+
@driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main", "one", "two"]])
|
208
|
+
@driver.mexpect("if_controller_init", [base, base+1, "my_controller", {}])
|
209
|
+
@driver.mexpect("if_attach_view", [base+1, 0])
|
210
|
+
@driver.mexpect("if_init_view", ["my_other_controller", {}, base+5, ["main"]])
|
211
|
+
@driver.mexpect("if_controller_init", [base+4, base+5, "my_other_controller", {}])
|
212
|
+
@driver.mexpect("if_attach_view", [base+5, base+2])
|
213
|
+
@driver.mexpect("if_event", [base+4, "action", {"from" => nil, "to" => "index"}])
|
214
|
+
@driver.mexpect("if_event", [base, "action", {"from" => nil, "to" => "index"}])
|
215
|
+
|
216
|
+
#Expect the view to be removed, and for our action to switch
|
217
|
+
@driver.mexpect("if_free_view", [base+5])
|
218
|
+
@driver.mexpect("if_event", [base, "action", {"from" => "index", "to" => "other"}])
|
219
|
+
|
220
|
+
@driver.int "int_debug_dump_ui", []
|
221
|
+
@driver.mexpect("if_event", [-333, "debug_dump_ui_res", {
|
222
|
+
"type" => "spot",
|
223
|
+
"name" => "root",
|
224
|
+
"ptr" => 0,
|
225
|
+
"children" => [
|
226
|
+
{
|
227
|
+
"name" => "my_controller",
|
228
|
+
"events" => ["test2"],
|
229
|
+
"ptr" => base,
|
230
|
+
"type" => "vc",
|
231
|
+
"action" => "other",
|
232
|
+
"children" => [
|
233
|
+
{
|
234
|
+
"type" => "view",
|
235
|
+
"name" => "my_controller",
|
236
|
+
"ptr" => base+1,
|
237
|
+
"children" => [
|
238
|
+
{"name" => "one", "type" => "spot", "children" => [], "ptr" => base+2},
|
239
|
+
{"name" => "two", "type" => "spot", "children" => [], "ptr" => base+3},
|
240
|
+
]
|
241
|
+
}
|
242
|
+
]
|
243
|
+
}
|
244
|
+
]
|
245
|
+
}])
|
246
|
+
end
|
247
247
|
|
248
248
|
it "Can go forward and then back and have the correct hierarchy (where a parent controlls children like nav)" do
|
249
249
|
#Compile the controller
|