Changeset 5aa33fd for tester.c


Ignore:
Timestamp:
May 22, 2010, 10:37:25 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
04b16f8
Parents:
de18326
git-author:
Nelson Elhage <nelhage@mit.edu> (05/19/10 00:39:49)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/22/10 22:37:25)
Message:
Merge perl_tester and tester.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    rc2673ab r5aa33fd  
     1#define OWL_PERL
     2#define WINDOW FAKE_WINDOW
    13#include "owl.h"
     4#undef WINDOW
     5
    26#include <unistd.h>
    37#include <stdlib.h>
     8
     9#undef instr
     10#include <curses.h>
    411
    512owl_global g;
     
    1421int owl_obarray_regtest(void);
    1522int owl_editwin_regtest(void);
     23
     24extern void owl_perl_xs_init(pTHX);
    1625
    1726int main(int argc, char **argv, char **env)
     
    3544  owl_global_complete_setup(&g);
    3645
    37   status = owl_regtest();
     46  if (argc > 1) {
     47    char *code;
     48    FILE *f;
     49
     50    if (strcmp(argv[1], "-le") == 0 && argc > 2) {
     51      /*
     52       * 'prove' runs its harness perl with '-le CODE' to get some
     53       * information out.
     54       */
     55      moreswitches("l");
     56      code = argv[2];
     57    } else {
     58      f = fopen(argv[1], "r");
     59      if (!f) {
     60        perror(argv[1]);
     61        status = 1;
     62        goto out;
     63      }
     64      code = owl_slurp(f);
     65      sv_setpv(get_sv("0", false), argv[1]);
     66    }
     67
     68    ENTER;
     69    SAVETMPS;
     70
     71    eval_pv(code, true);
     72
     73    status = 0;
     74
     75    FREETMPS;
     76    LEAVE;
     77  } else {
     78    status = owl_regtest();
     79  }
    3880
    3981 out:
     82  perl_destruct(owl_global_get_perlinterp(&g));
     83  perl_free(owl_global_get_perlinterp(&g));
    4084  /* probably not necessary, but tear down the screen */
    4185  endwin();
Note: See TracChangeset for help on using the changeset viewer.