diff --git a/one-clause/index.html b/one-clause/index.html index 08111e3..1041992 100644 --- a/one-clause/index.html +++ b/one-clause/index.html @@ -158,16 +158,20 @@

// crates/deed-driver/tests/demo.rs -let stopped = call(&module, "process", &[Value::I64(0), Value::I64(0)]) - .expect_err("read_write needs a host to provide save"); +let mut host = Host::new(); +host.offer("deed:io", "read", |_| Ok(Some(Value::I64(0)))); -let Trap::NeedsAHost(what) = stopped else { - panic!("it should say what it wanted, not {stopped}"); -}; +let refused = host + .link(&module_for("read_write.deed")) + .expect_err("a host that cannot save should refuse the module that saves"); + +assert_eq!(refused.name, "save");

- NeedsAHost carries the name of the operation the module - asked for, and it is reached before any instruction of - process executes. + Host::link reads the whole import list and answers + before an instruction runs. The same host links the read-only module + and hands it back ready to call, which is the other half of it: a + host that refused both would be a host with no filesystem, and that + would say nothing about the clause.

None of this is checked by eye

@@ -177,12 +181,14 @@

$ cargo test -p deed-driver --test demo -running 5 tests +running 7 tests test read_only_imports_read_and_nothing_else ... ok -test running_read_only_without_a_host_names_read ... ok test read_write_imports_read_and_save ... ok -test running_read_write_without_save_names_what_it_wanted ... ok -test the_readme_lists_the_imports_the_modules_actually_have ... ok +test a_host_without_save_refuses_read_write_and_names_save ... ok +test the_same_host_links_read_only_without_restriction ... ok +test running_without_a_host_stops_at_the_first_import_either_way ... ok +test the_readme_lists_the_imports_the_modules_actually_have ... ok +test the_readme_lists_the_tests_this_file_declares ... ok

The last one exists because the listing on this page and in