From 56356de8793d0b2a9a2260401b70dc05fd2be982 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 24 Oct 2016 15:06:15 -0700 Subject: 3588 - documentation for filesystem and network --- Readme.md | 8 ++++---- html/fake-filesystem.png | Bin 21909 -> 0 bytes html/resources.mu | 18 ++++++++++++++++++ html/resources.png | Bin 0 -> 21555 bytes index.html | 27 +++++++++++++++++++++------ 5 files changed, 43 insertions(+), 10 deletions(-) delete mode 100644 html/fake-filesystem.png create mode 100644 html/resources.mu create mode 100644 html/resources.png diff --git a/Readme.md b/Readme.md index 2af72102..51eb9c1a 100644 --- a/Readme.md +++ b/Readme.md @@ -216,12 +216,12 @@ Similarly you can fake the keyboard to pretend someone typed something: fake console (keyboard, mouse, ..) -A fake file-system can map arbitrary paths to contents: +Within tests you can map arbitrary paths (local files or URLs) to contents: -fake file-system +fake file-system and network -As we add network support, graphics, audio, and so on, we'll augment scenarios -with corresponding abilities. +As we add graphics, audio, and so on, we'll augment scenarios with +corresponding abilities. --- diff --git a/html/fake-filesystem.png b/html/fake-filesystem.png deleted file mode 100644 index b088265b..00000000 Binary files a/html/fake-filesystem.png and /dev/null differ diff --git a/html/resources.mu b/html/resources.mu new file mode 100644 index 00000000..79bb999f --- /dev/null +++ b/html/resources.mu @@ -0,0 +1,18 @@ + + + + + assume-resources [ + # contents for a local file + [/foo/bar] <- [ + |def| # lines delimited by '|' + ] + + # contents for a URL + [example.com/foo/bar] <- [ + |abc| + ] + ] + + + diff --git a/html/resources.png b/html/resources.png new file mode 100644 index 00000000..4222c5d0 Binary files /dev/null and b/html/resources.png differ diff --git a/index.html b/index.html index 2d178504..1d9dd349 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,6 @@ syntax, using the special labels '{' and '}'.
  • tangle.mu: another (contrived) version of factorial showing Mu's ability to 'tangle' code from multiple places into a single function or recipe. -
  • counters.mu: lexical scope
  • simple examples showing off support for concurrency: fork.mu, channel.mu
  • simple examples showing off hardware control: display.mu, @@ -40,9 +39,13 @@ for testing.
  • filesystem.mu: example program showing file primitives that inject a 'filesystem' dependency which can be faked for testing. +
  • http-client.mu and http-server.mu, +examples of Mu's testable high-level interfaces to the network.
  • static-dispatch.mu: example -program showing mu's ability to define recipes with headers, and allow -recipes with the same name but different headers to coexist. +program showing mu's ability to define recipes with headers, and thereby to +allow functions with the same name but arguments of different types to +coexist. +
  • counters.mu: lexical scope
  • chessboard.mu: a little program for 2 people to play chess, with thorough tests of its behavior including both screen and keyboard handling. @@ -230,8 +233,8 @@ generator with a testable interface.

    Part V: Primitives for interfacing with hardware. -

    080display.cc: primitives for using -the keyboard and screen. +

    080display.cc: primitives for +accessing the keyboard and screen.
    081print.mu: helpers that can swap the real screen with fake ones for testing.
    082scenario_screen.cc: @@ -242,8 +245,20 @@ swap the real keyboard and mouse with fake ones for testing.
    085scenario_console.cc: writing tests for keyboard and mouse using the fakes. (examples) +
    087file.cc: primitives for accessing +the file system. +
    088file.mu: helpers that permit +swapping a fake filesystem or resources object for testing. +
    089scenario_filesystem.cc: +writing tests for filesystem using the fakes. +(examples) +
    091socket.cc: primitives for +accessing the network. +
    092socket.mu: helpers for the +network. In Mu you create a fake network ‘neighborhood’ the same +way you create a fake local file system. -
    029tools.cc: various primitive +

    029tools.cc: various primitive operations to help with testing and debugging.
    100trace_browser.cc: a zoomable UI for inspecting traces generated by Mu programs. Allows both -- cgit 1.4.1-2-gfad0 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 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479