aboutsummaryrefslogtreecommitdiff
path: root/tests/builtin
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-06-01 19:51:17 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-06-03 12:23:29 +0300
commit70314b3303f712a0277b80b23bc3613744e6178e (patch)
treec20b0cddf91b2d2303feee440ec07c36fd5d0cd6 /tests/builtin
parentc0a025542988b63275fe1f9281020f4d4bec58a6 (diff)
Add builtin weight
Also invent the notion of external builtin (builtin_info::function is NULL).
Diffstat (limited to 'tests/builtin')
-rw-r--r--tests/builtin/driver.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/builtin/driver.cxx b/tests/builtin/driver.cxx
index 2583ba2..9fb6d6f 100644
--- a/tests/builtin/driver.cxx
+++ b/tests/builtin/driver.cxx
@@ -144,15 +144,21 @@ main (int argc, char* argv[])
// Execute the builtin.
//
- builtin_function* bf (builtins.find (name));
+ const builtin_info* bi (builtins.find (name));
- if (bf == nullptr)
+ if (bi == nullptr)
{
cerr << "unknown builtin '" << name << "'" << endl;
return 1;
}
+ if (bi->function == nullptr)
+ {
+ cerr << "external builtin '" << name << "'" << endl;
+ return 1;
+ }
+
uint8_t r; // Storage.
- builtin b (bf (r, args, nullfd, nullfd, nullfd, cwd, callbacks));
+ builtin b (bi->function (r, args, nullfd, nullfd, nullfd, cwd, callbacks));
return b.wait ();
}