From 57fb2d49a467981fd3912bd54e31754096932016 Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Mon, 1 Feb 2021 23:12:59 -0800 Subject: [PATCH] Add arg parsing an use in tests. --- ueforth/Makefile | 11 +++-------- ueforth/common/core_test.fs | 3 --- ueforth/common/core_test.fs.golden | 3 --- ueforth/posix/args.fs | 3 +++ 4 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 ueforth/common/core_test.fs delete mode 100644 ueforth/common/core_test.fs.golden create mode 100644 ueforth/posix/args.fs diff --git a/ueforth/Makefile b/ueforth/Makefile index 36a2a32..f03e1d9 100644 --- a/ueforth/Makefile +++ b/ueforth/Makefile @@ -103,15 +103,10 @@ clean: # ---- TESTS ---- -tests: core_test unit_tests - -core_test: $(POSIX)/ueforth common/core_test.fs \ - common/core_test.fs.golden - echo "include common/core_test.fs" | $< | \ - diff - common/core_test.fs.golden +tests: unit_tests unit_tests: $(POSIX)/ueforth common/all_tests.fs - echo "include common/all_tests.fs" | $< + $^ # ---- GENERATED ---- @@ -121,7 +116,7 @@ $(GEN): POSIX_BOOT = common/boot.fs common/ansi.fs \ posix/posix.fs posix/posix_highlevel.fs \ common/highlevel.fs common/filetools.fs posix/posix_desktop.fs \ - common/tasks.fs common/streams.fs common/blocks.fs + common/tasks.fs common/streams.fs common/blocks.fs posix/args.fs $(GEN)/posix_boot.h: common/source_to_string.js $(POSIX_BOOT) | $(GEN) echo "ok" | cat $(POSIX_BOOT) - | $< boot >$@ diff --git a/ueforth/common/core_test.fs b/ueforth/common/core_test.fs deleted file mode 100644 index 53cea48..0000000 --- a/ueforth/common/core_test.fs +++ /dev/null @@ -1,3 +0,0 @@ -: test 100 0 do i . loop cr ; -test -bye diff --git a/ueforth/common/core_test.fs.golden b/ueforth/common/core_test.fs.golden deleted file mode 100644 index 9690872..0000000 --- a/ueforth/common/core_test.fs.golden +++ /dev/null @@ -1,3 +0,0 @@ -uEForth - ok -0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 diff --git a/ueforth/posix/args.fs b/ueforth/posix/args.fs new file mode 100644 index 0000000..f914add --- /dev/null +++ b/ueforth/posix/args.fs @@ -0,0 +1,3 @@ +( Include first argument if any ) +: optional-args argc 2 < if exit then 1 argv included ; +optional-args