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