From 9542bb112419d575190a72baf7f964c3e32df223 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 25 Jul 2015 22:15:51 -0700 Subject: 1853 --- html/028assert.cc.html | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'html/028assert.cc.html') diff --git a/html/028assert.cc.html b/html/028assert.cc.html index 68951156..3adae63f 100644 --- a/html/028assert.cc.html +++ b/html/028assert.cc.html @@ -13,12 +13,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } -.traceContains { color: #008000; } .cSpecial { color: #008000; } .Constant { color: #00a0a0; } +.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } .Delimiter { color: #a04060; } .Special { color: #ff6060; } .Identifier { color: #804000; } +.traceContains { color: #008000; } --> @@ -33,7 +34,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } :(scenario assert) % Hide_warnings = true; // '%' lines insert arbitrary C code into tests before calling 'run' with the lines below. Must be immediately after :(scenario) line. recipe main [ - assert 0:literal, [this is an assert in mu] + assert 0:literal, [this is an assert in mu] ] +warn: this is an assert in mu @@ -42,12 +43,21 @@ ASSERT, :(before "End Primitive Recipe Numbers") Recipe_ordinal["assert"] = ASSERT; :(before "End Primitive Recipe Implementations") -case ASSERT: { - assert(SIZE(ingredients) == 2); - assert(scalar(ingredients.at(0))); - if (!ingredients.at(0).at(0)) { - assert(is_literal(current_instruction().ingredients.at(1))); - raise << current_instruction().ingredients.at(1).name << '\n' << die(); +case ASSERT: { + if (SIZE(ingredients) != 2) { + raise << current_recipe_name() << ": 'assert' takes exactly two ingredients rather than '" << current_instruction().to_string() << "'\n" << end(); + break; + } + if (!scalar(ingredients.at(0))) { + raise << current_recipe_name() << ": 'assert' requires a boolean for its first ingredient, but got " << current_instruction().ingredients.at(0).original_string << '\n' << end(); + break; + } + if (!scalar(ingredients.at(1))) { + raise << current_recipe_name() << ": 'assert' requires a literal string for its second ingredient, but got " << current_instruction().ingredients.at(1).original_string << '\n' << end(); + break; + } + if (!ingredients.at(0).at(0)) { + raise << current_instruction().ingredients.at(1).name << '\n' << end(); } break; } -- cgit 1.4.1-2-gfad0