commit - 4c5e4e230791c42af5aef6265f687b7cef8ddd39
commit + f3289b7eab31bc5780db03c4b54a04d066863493
blob - 46732a7fad8ee4cf5c15dc6a0e777d173e597e2f
blob + 61faea94872fdd06f33f7b56e8952074df6274fb
--- script.c
+++ script.c
static int debug;
static int syntaxcheck;
+static const char *filler;
+
static inline void
+before_printing(void)
+{
+ if (filler != NULL) {
+ printf("%s", filler);
+ filler = NULL;
+ }
+}
+
+static inline void
peekn(int depth, struct value *v)
{
if (depth > stackh)
}
}
+ before_printing();
fprintf(stderr, "unbound variable %s\n", sym);
return EVAL_ERR;
}
}
}
+ before_printing();
fprintf(stderr, "no rest argument `...'\n");
return EVAL_ERR;
}
case V_U16: return a->v.u16;
case V_U32: return a->v.u32;
default:
+ before_printing();
fprintf(stderr, "%s: given value is not a number\n", __func__);
abort();
}
#define NUMCAST(val, t, c, totype, max) do { \
if (val > max) { \
+ before_printing(); \
fprintf(stderr, "can't cast %"PRIu64 \
" to %s\n", val, pp_totype(totype)); \
return EVAL_ERR; \
} while (0)
if (!val_isnum(a)) {
+ before_printing();
fprintf(stderr, "can't cast ");
ppf_val(stderr, a);
fprintf(stderr, " to type %s\n", pp_totype(totype));
case V_U16: NUMCAST(v, u16, uint16_t, totype, UINT16_MAX);
case V_U32: NUMCAST(v, u32, uint32_t, totype, UINT32_MAX);
default:
+ before_printing();
fprintf(stderr, "can't cast %"PRIu64" to %s\n",
v, pp_totype(totype));
return EVAL_ERR;
return ret;
popv(&a);
if (!val_trueish(&a)) {
+ before_printing();
printf("assertion failed: ");
pp_op(op->v.assert);
printf("\n");
break;
default:
+ before_printing();
fprintf(stderr, "invalid op, aborting.\n");
abort();
}
struct value v;
int i;
+ before_printing();
+
for (i = argc; i > 0; --i) {
peekn(i, &v);
if (v.type == V_STR)
run_test(struct test *t)
{
#if DEBUG
+ before_printing();
puts("=====================");
pp_block(t->body);
puts("=====================");
{
struct env *e;
struct test *t;
- int ch, i, passed = 0, failed = 0, skipped = 0;
+ int ch, i, r, passed = 0, failed = 0, skipped = 0;
log_init(1, LOG_DAEMON);
log_setverbose(1);
printf("===> running test \"%s\"... ", t->name);
fflush(stdout);
- switch (run_test(t)) {
+ filler = "\n";
+ r = run_test(t);
+ if (filler == NULL)
+ printf("=> test ");
+
+ switch (r) {
case EVAL_OK:
printf("ok!\n");
passed++;
break;
case EVAL_ERR:
failed++;
- /* we've already printed the failure */
- printf("\n");
+ printf("failed\n");
break;
case EVAL_SKIP:
- printf("skipped!\n");
+ printf("skipped\n");
skipped++;
break;
}
+ printf("\n");
i++;
}
+ printf("\n");
printf("passed %d/%d\n", passed, i);
printf("failed %d\n", failed);
printf("skipped %d\n", skipped);