diff options
40 files changed, 305 insertions, 183 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 2fb0813..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,152 +0,0 @@ -cmake_minimum_required(VERSION 3.25) - -project(aplwc - VERSION 0.0.1 - LANGUAGES C -) - -set(CMAKE_C_STANDARD 90) -set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_C_EXTENSIONS OFF) - -add_library(common INTERFACE) -target_include_directories(common INTERFACE - "src/include" -) -target_compile_options(common INTERFACE - $<$<CONFIG:Debug>: - -O0 - -Wall - -Wextra - -Wpedantic - -Werror - -fsanitize=address,undefined - -DAPLWC_BUILD_TYPE_DEBUG - > - - $<$<CONFIG:Coverage>: - -O0 - -g - --coverage - -fcondition-coverage - -DAPLWC_BUILD_TYPE_COVERAGE - -DNDEBUG - > - - $<$<CONFIG:Release>: - -DAPLWC_BUILD_TYPE_RELEASE - > -) -target_link_options(common INTERFACE - $<$<CONFIG:Debug>: - -fsanitize=address,undefined - > - - $<$<CONFIG:Coverage>: - --coverage - -fcondition-coverage - > -) - -add_library(aplwc - ${CMAKE_CURRENT_BINARY_DIR}/generated_headers/boot.h - src/lib/eval.c - src/lib/main.c - src/lib/memory.c - src/lib/module.c - src/lib/string.c - src/lib/symtab.c - src/lib/syntax.c -) -target_link_libraries(aplwc PRIVATE common) -target_include_directories(aplwc PRIVATE - "${CMAKE_CURRENT_BINARY_DIR}/generated_headers/" -) - -add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated_headers/boot.h" - COMMAND xxd -i -n boot_src "${CMAKE_CURRENT_SOURCE_DIR}/src/lib/boot.aplwc" "${CMAKE_CURRENT_BINARY_DIR}/generated_headers/boot.h" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/lib/boot.aplwc" - COMMENT "Generate boot.h from boot.aplwc" -) - -add_executable(aplwc-repl - src/bin/main.c - src/bin/util.c -) -target_link_libraries(aplwc-repl PRIVATE common aplwc) - -enable_testing() -file(GLOB TEST_SOURCES CONFIGURE_DEPENDS "tests/*.c") -foreach(source ${TEST_SOURCES}) - get_filename_component(name "${source}" NAME_WE) - set(test_bin "testbin-${name}") - add_executable("${test_bin}" "${source}") - target_link_libraries("${test_bin}" PRIVATE common aplwc) - - if("${name}" STREQUAL "aplwc_read" OR "${name}" STREQUAL "aplwc_eval") - file(GLOB GOOD_INPUTS CONFIGURE_DEPENDS "tests/${name}/good/*.txt") - file(GLOB BAD_INPUTS CONFIGURE_DEPENDS "tests/${name}/bad/*.txt") - foreach(input ${GOOD_INPUTS}) - add_test(NAME "${name} ${input}" COMMAND "${test_bin}" "${input}") - endforeach() - foreach(input ${BAD_INPUTS}) - add_test(NAME "${name} ${input}" COMMAND "${test_bin}" "${input}") - set_tests_properties("${name} ${input}" PROPERTIES - WILL_FAIL TRUE - ) - endforeach() - else() - add_test(NAME "${name}" COMMAND "${test_bin}") - endif() -endforeach() - -file(GLOB TEST_SCRIPTS_GOOD CONFIGURE_DEPENDS "tests/scripts/good/*.aplwc") -foreach(script ${TEST_SCRIPTS_GOOD}) - add_test(NAME "${script}" COMMAND "${script}") - set_tests_properties("${script}" PROPERTIES - ENVIRONMENT "PATH=$<TARGET_FILE_DIR:aplwc-repl>" - ) - - add_test(NAME "aplwc-repl ${script}" COMMAND "aplwc-repl" "${script}") - set_tests_properties("aplwc-repl ${script}" PROPERTIES - ENVIRONMENT "PATH=$<TARGET_FILE_DIR:aplwc-repl>" - ) - - add_test(NAME "simfail ${script}" COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/scripts/simfail.sh" "${script}") - set_tests_properties("simfail ${script}" PROPERTIES - ENVIRONMENT "PATH=$<TARGET_FILE_DIR:aplwc-repl>" - ) -endforeach() - -file(GLOB TEST_SCRIPTS_BAD CONFIGURE_DEPENDS "tests/scripts/bad/*.aplwc") -foreach(script ${TEST_SCRIPTS_BAD}) - add_test(NAME "aplwc-repl ${script}" COMMAND "aplwc-repl" "${script}") - set_tests_properties("aplwc-repl ${script}" PROPERTIES - ENVIRONMENT "PATH=$<TARGET_FILE_DIR:aplwc-repl>" - WILL_FAIL TRUE - ) -endforeach() - -file(GLOB TEST_SCRIPTS_GOOD CONFIGURE_DEPENDS "tests/scripts/good/*.sh") -foreach(script ${TEST_SCRIPTS_GOOD}) - add_test(NAME "${script}" COMMAND "${script}") - set_tests_properties("${script}" PROPERTIES - ENVIRONMENT "PATH=$<TARGET_FILE_DIR:aplwc-repl>" - ) - add_test(NAME "simfail ${script}" COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/scripts/simfail.sh" "${script}") - set_tests_properties("simfail ${script}" PROPERTIES - ENVIRONMENT "PATH=$<TARGET_FILE_DIR:aplwc-repl>" - ) -endforeach() - -file(GLOB TEST_SCRIPTS_BAD CONFIGURE_DEPENDS "tests/scripts/bad/*.sh") -foreach(script ${TEST_SCRIPTS_BAD}) - add_test(NAME "${script}" COMMAND "${script}") - set_tests_properties("${script}" PROPERTIES - ENVIRONMENT "PATH=$<TARGET_FILE_DIR:aplwc-repl>" - WILL_FAIL TRUE - ) -endforeach() - -add_test(NAME "aplwc-repl" COMMAND "aplwc-repl" "-x") diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..faeeead --- /dev/null +++ b/Makefile.am @@ -0,0 +1,23 @@ +bin_PROGRAMS = +noinst_PROGRAMS = +check_PROGRAMS = +lib_LIBRARIES = +include_HEADERS = +noinst_HEADERS = +BUILT_SOURCES = +CLEANFILES = +EXTRA_DIST = +TESTS = +TEST_EXTENSIONS = +TEST_INPUTS = +TEST_SCRIPTS_APLWC = +TEST_SCRIPTS_SH = +XFAIL_TESTS = +AM_TESTS_ENVIRONMENT = PATH="$(top_bindir):$$PATH"; export PATH; +AM_CPPFLAGS = -I$(top_srcdir)/src/include/ -I$(top_builddir)/generated + +include src/Makefile.am +include tests/Makefile.am + +TESTS += $(TEST_INPUTS) $(TEST_SCRIPTS_SH) $(TEST_SCRIPTS_APLWC) +EXTRA_DIST += $(TEST_INPUTS) $(TEST_SCRIPTS_SH) $(TEST_SCRIPTS_APLWC) diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..8131af0 --- /dev/null +++ b/configure.ac @@ -0,0 +1,32 @@ +AC_INIT([aplwc], [0.0.1], [peter@pmikkelsen.com], [aplwc], [aplwc.org]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign posix subdir-objects]) +AM_SILENT_RULES([yes]) + +AC_CONFIG_SRCDIR([src/bin/main.c]) +AC_CONFIG_HEADERS([config.h]) + +AC_PROG_CC +AC_PROG_RANLIB +AM_PROG_AR + +AC_ARG_ENABLE([build-mode], + [AS_HELP_STRING([--enable-build-mode=MODE], + [select build mode: debug, release or coverage (default: release)])], + [AS_CASE([$enableval], + [debug], [build_mode="debug"], + [release], [build_mode="release"], + [coverage], [build_mode="coverage"], + [AC_MSG_ERROR([Invalid value for --enable-build-mode: $enableval])])], + [build_mode="release"]) +AC_MSG_CHECKING([build mode]) +AC_MSG_RESULT([$build_mode]) +AS_CASE([$build_mode], + [debug], [AC_DEFINE([APLWC_BUILD_TYPE_DEBUG], [1], [Defined if the build mode is "debug"])], + [release], [AC_DEFINE([APLWC_BUILD_TYPE_RELEASE], [1], [Defined if the build mode is "release"])], + [coverage], [AC_DEFINE([APLWC_BUILD_TYPE_COVERAGE], [1], [Defined if the build mode is "coverage"])] +) + +AC_CONFIG_FILES([ + Makefile +]) +AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..1e7e4e2 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,4 @@ +include src/bin/Makefile.am +include src/include/Makefile.am +include src/lib/Makefile.am +include src/tools/Makefile.am diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am new file mode 100644 index 0000000..bc25fbb --- /dev/null +++ b/src/bin/Makefile.am @@ -0,0 +1,8 @@ +bin_PROGRAMS += aplwc + +aplwc_SOURCES = \ + src/bin/aplwc_repl.h \ + src/bin/main.c \ + src/bin/util.c + +aplwc_LDADD = libaplwc.a diff --git a/src/include/Makefile.am b/src/include/Makefile.am new file mode 100644 index 0000000..3f082fb --- /dev/null +++ b/src/include/Makefile.am @@ -0,0 +1,2 @@ +include_HEADERS += src/include/aplwc.h +noinst_HEADERS += src/include/aplwc_macros.h diff --git a/src/include/aplwc_macros.h b/src/include/aplwc_macros.h index 80ada28..3c8aa6b 100644 --- a/src/include/aplwc_macros.h +++ b/src/include/aplwc_macros.h @@ -20,6 +20,8 @@ #ifndef APLWC_MACROS_H #define APLWC_MACROS_H +#include <config.h> + #define UNUSED_PARAMETER(arg) ((void)arg) #define NELEM(x) (sizeof(x)/sizeof(x[0])) diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am new file mode 100644 index 0000000..c95fe1c --- /dev/null +++ b/src/lib/Makefile.am @@ -0,0 +1,13 @@ +lib_LIBRARIES += libaplwc.a + +libaplwc_a_SOURCES = \ + src/lib/aplwc_internal.h \ + src/lib/eval.c \ + src/lib/main.c \ + src/lib/memory.c \ + src/lib/module.c \ + src/lib/string.c \ + src/lib/symtab.c \ + src/lib/syntax.c + +EXTRA_DIST += src/lib/boot.aplwc diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am new file mode 100644 index 0000000..b1079e7 --- /dev/null +++ b/src/tools/Makefile.am @@ -0,0 +1,10 @@ +noinst_PROGRAMS += genboot + +genboot_SOURCES = src/tools/genboot.c + +BUILT_SOURCES += $(top_builddir)/generated/boot.h +CLEANFILES += $(top_builddir)/generated/boot.h + +$(top_builddir)/generated/boot.h: genboot src/lib/boot.aplwc + $(MKDIR_P) $(top_builddir)/generated + ./genboot $(top_srcdir)/src/lib/boot.aplwc > $@ diff --git a/src/tools/genboot.c b/src/tools/genboot.c new file mode 100644 index 0000000..6f2e408 --- /dev/null +++ b/src/tools/genboot.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <assert.h> + +int +main(int argc, char *argv[]) +{ + assert(argc == 2); + FILE *f = fopen(argv[1], "r"); + assert(f != NULL); + + printf("unsigned char boot_src[] = { "); + + int c; + int s = 0; + while((c = fgetc(f)) != EOF){ + if(s++ > 0) + printf(", "); + printf("0x%02x", c); + } + + printf(" };\n"); + printf("unsigned int boot_src_len = %d;\n", s); + + return 0; +} diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..479b7ac --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,91 @@ +LOG_COMPILER = $(top_srcdir)/tests/run_script_test.sh +EXTRA_DIST += $(LOG_COMPILER) +EXTRA_DIST += tests/scripts/simfail.sh + +check_PROGRAMS += testbin-aplwc_errstr +testbin_aplwc_errstr_SOURCES = tests/aplwc_errstr.c +testbin_aplwc_errstr_LDADD = libaplwc.a +TESTS += testbin-aplwc_errstr + +check_PROGRAMS += testbin-aplwc_utf8 +testbin_aplwc_utf8_SOURCES= tests/aplwc_utf8.c +testbin_aplwc_utf8_LDADD = libaplwc.a +TESTS += testbin-aplwc_utf8 + +TEST_EXTENSIONS += .txt +TXT_LOG_COMPILER = $(top_srcdir)/tests/run_simple_test.sh +EXTRA_DIST += $(TXT_LOG_COMPILER) + +check_PROGRAMS += testbin-aplwc_eval +testbin_aplwc_eval_SOURCES= tests/aplwc_eval.c +testbin_aplwc_eval_LDADD = libaplwc.a +TEST_INPUTS += \ + tests/aplwc_eval/good/1.txt \ + tests/aplwc_eval/good/2.txt \ + tests/aplwc_eval/good/3.txt + +check_PROGRAMS += testbin-aplwc_read +testbin_aplwc_read_SOURCES= tests/aplwc_read.c +testbin_aplwc_read_LDADD = libaplwc.a +TEST_INPUTS += \ + tests/aplwc_read/good/1.txt \ + tests/aplwc_read/good/2.txt \ + tests/aplwc_read/good/3.txt \ + tests/aplwc_read/good/4.txt \ + tests/aplwc_read/good/5.txt \ + tests/aplwc_read/good/6.txt \ + tests/aplwc_read/good/7.txt \ + tests/aplwc_read/good/8.txt \ + tests/aplwc_read/good/9.txt \ + tests/aplwc_read/good/10.txt \ + tests/aplwc_read/good/11.txt \ + tests/aplwc_read/good/12.txt \ + tests/aplwc_read/good/13.txt +TEST_INPUTS += \ + tests/aplwc_read/bad/1.txt \ + tests/aplwc_read/bad/2.txt \ + tests/aplwc_read/bad/3.txt \ + tests/aplwc_read/bad/4.txt \ + tests/aplwc_read/bad/5.txt \ + tests/aplwc_read/bad/6.txt + +TEST_SCRIPTS_SH += \ + tests/scripts/good/1.sh \ + tests/scripts/good/2.sh \ + tests/scripts/good/3.sh \ + tests/scripts/good/4.sh \ + tests/scripts/good/5.sh \ + tests/scripts/good/6.sh \ + tests/scripts/good/7.sh +TEST_SCRIPTS_SH += \ + tests/scripts/bad/1.sh \ + tests/scripts/bad/2.sh \ + tests/scripts/bad/3.sh \ + tests/scripts/bad/4.sh \ + tests/scripts/bad/5.sh \ + tests/scripts/bad/6.sh \ + tests/scripts/bad/7.sh + +TEST_SCRIPTS_APLWC += \ + tests/scripts/good/1.aplwc \ + tests/scripts/good/2.aplwc \ + tests/scripts/good/3.aplwc + +TEST_SCRIPTS_APLWC += \ + tests/scripts/bad/1.aplwc \ + tests/scripts/bad/2.aplwc \ + tests/scripts/bad/3.aplwc \ + tests/scripts/bad/4.aplwc \ + tests/scripts/bad/5.aplwc \ + tests/scripts/bad/6.aplwc \ + tests/scripts/bad/7.aplwc \ + tests/scripts/bad/8.aplwc \ + tests/scripts/bad/9.aplwc \ + tests/scripts/bad/10.aplwc \ + tests/scripts/bad/11.aplwc \ + tests/scripts/bad/12.aplwc \ + tests/scripts/bad/13.aplwc + +XFAIL_TESTS += \ + tests/scripts/bad/1.aplwc \ + tests/scripts/bad/3.aplwc diff --git a/tests/run_script_test.sh b/tests/run_script_test.sh new file mode 100755 index 0000000..cef7add --- /dev/null +++ b/tests/run_script_test.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +input=$1 + +input=${input#*/tests/scripts/} +expected=${input%%/*} +ext=${input##*.} + +check() +{ + status=$1 + case $expected in + bad) + [ "$status" -ne 0 ] + ;; + *) + [ "$status" -eq 0 ] + ;; + esac + if [ "$?" -ne 0 ]; then + exit 1 + fi +} + +"$1" +check $? + +case "$ext" in + aplwc) + aplwc "$1" + check $? + ;; +esac + +case $expected in + *) + "$srcdir/tests/scripts/simfail.sh" "$1" + check $? +esac diff --git a/tests/run_simple_test.sh b/tests/run_simple_test.sh new file mode 100755 index 0000000..6c1d56c --- /dev/null +++ b/tests/run_simple_test.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +input=$1 + +input=${input#*/tests/} +program=${input%%/*} + +input=${input#*/} +expected=${input%%/*} + +"./testbin-$program" "$1" +status=$? + +case $expected in + good) + [ "$status" -eq 0 ] + ;; + bad) + [ "$status" -ne 0 ] + ;; +esac diff --git a/tests/scripts/bad/10.aplwc b/tests/scripts/bad/10.aplwc index ae7d5f7..a82aa53 100755 --- a/tests/scripts/bad/10.aplwc +++ b/tests/scripts/bad/10.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc -:module
\ No newline at end of file +:module diff --git a/tests/scripts/bad/11.aplwc b/tests/scripts/bad/11.aplwc index 3de20cd..837ac9b 100755 --- a/tests/scripts/bad/11.aplwc +++ b/tests/scripts/bad/11.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc :module 123 diff --git a/tests/scripts/bad/12.aplwc b/tests/scripts/bad/12.aplwc index 471643b..99e3f91 100755 --- a/tests/scripts/bad/12.aplwc +++ b/tests/scripts/bad/12.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc -:symbol plus
\ No newline at end of file +:symbol plus diff --git a/tests/scripts/bad/13.aplwc b/tests/scripts/bad/13.aplwc index 50bdb9f..cdd33ef 100755 --- a/tests/scripts/bad/13.aplwc +++ b/tests/scripts/bad/13.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc :symbol plus + + diff --git a/tests/scripts/bad/14.aplwc b/tests/scripts/bad/14.aplwc index 6b609ee..1e6f29f 100755 --- a/tests/scripts/bad/14.aplwc +++ b/tests/scripts/bad/14.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc :peter diff --git a/tests/scripts/bad/15.aplwc b/tests/scripts/bad/15.aplwc index 0662ccd..fe16903 100755 --- a/tests/scripts/bad/15.aplwc +++ b/tests/scripts/bad/15.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc -'
\ No newline at end of file +' diff --git a/tests/scripts/bad/2.sh b/tests/scripts/bad/2.sh index 73321be..4c7516e 100755 --- a/tests/scripts/bad/2.sh +++ b/tests/scripts/bad/2.sh @@ -1,3 +1,3 @@ #!/bin/sh -aplwc-repl -x -? +aplwc -x -? diff --git a/tests/scripts/bad/3.sh b/tests/scripts/bad/3.sh index ff0e033..bebca76 100755 --- a/tests/scripts/bad/3.sh +++ b/tests/scripts/bad/3.sh @@ -1,3 +1,3 @@ #!/bin/sh -aplwc-repl -x some-file-which-does-not-exist +aplwc -x some-file-which-does-not-exist diff --git a/tests/scripts/bad/4.aplwc b/tests/scripts/bad/4.aplwc index 8934275..1dc7666 100755 --- a/tests/scripts/bad/4.aplwc +++ b/tests/scripts/bad/4.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc ∇ foo diff --git a/tests/scripts/bad/4.sh b/tests/scripts/bad/4.sh index 0c48eaf..ae70b35 100755 --- a/tests/scripts/bad/4.sh +++ b/tests/scripts/bad/4.sh @@ -1,3 +1,3 @@ #!/bin/sh -aplwc-repl -x f1 f2 +aplwc -x f1 f2 diff --git a/tests/scripts/bad/5.aplwc b/tests/scripts/bad/5.aplwc index 26b3140..b727d2c 100755 --- a/tests/scripts/bad/5.aplwc +++ b/tests/scripts/bad/5.aplwc @@ -1,4 +1,4 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc ∇ foo ' diff --git a/tests/scripts/bad/5.sh b/tests/scripts/bad/5.sh index 8411e21..a2635a5 100755 --- a/tests/scripts/bad/5.sh +++ b/tests/scripts/bad/5.sh @@ -1,3 +1,3 @@ #!/bin/sh -aplwc-repl -x /dev/stdin +aplwc -x /dev/stdin diff --git a/tests/scripts/bad/6.sh b/tests/scripts/bad/6.sh index 2d9a94c..21fcc38 100755 --- a/tests/scripts/bad/6.sh +++ b/tests/scripts/bad/6.sh @@ -1,4 +1,4 @@ #!/bin/sh export APLWC_SIMULATE_FAILURE_PRINT_COUNT=1 -aplwc-repl -x 3>&- +aplwc -x 3>&- diff --git a/tests/scripts/bad/7.aplwc b/tests/scripts/bad/7.aplwc index ae9dcf3..cd50d41 100755 --- a/tests/scripts/bad/7.aplwc +++ b/tests/scripts/bad/7.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc -:symbol
\ No newline at end of file +:symbol diff --git a/tests/scripts/bad/7.sh b/tests/scripts/bad/7.sh index 189a5f0..8bf9d13 100755 --- a/tests/scripts/bad/7.sh +++ b/tests/scripts/bad/7.sh @@ -1,4 +1,4 @@ #!/bin/sh export APLWC_SIMULATE_FAILURE_AT=100 -aplwc-repl -x /dev/stdin +aplwc -x /dev/stdin diff --git a/tests/scripts/bad/8.aplwc b/tests/scripts/bad/8.aplwc index c2610e0..573edec 100755 --- a/tests/scripts/bad/8.aplwc +++ b/tests/scripts/bad/8.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc :symbol 123 diff --git a/tests/scripts/bad/9.aplwc b/tests/scripts/bad/9.aplwc index 469cc0b..e4ca077 100755 --- a/tests/scripts/bad/9.aplwc +++ b/tests/scripts/bad/9.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc :symbol plus 123 diff --git a/tests/scripts/good/1.aplwc b/tests/scripts/good/1.aplwc index e101d02..7a86f8f 100755 --- a/tests/scripts/good/1.aplwc +++ b/tests/scripts/good/1.aplwc @@ -1,4 +1,4 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc ∇ run ⎕←40 + 2 diff --git a/tests/scripts/good/2.aplwc b/tests/scripts/good/2.aplwc index e60e717..b6b5e63 100755 --- a/tests/scripts/good/2.aplwc +++ b/tests/scripts/good/2.aplwc @@ -1,4 +1,4 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc ∇ run foo 123 diff --git a/tests/scripts/good/2.sh b/tests/scripts/good/2.sh index 9bb0268..e0d41f3 100755 --- a/tests/scripts/good/2.sh +++ b/tests/scripts/good/2.sh @@ -2,4 +2,4 @@ set -e -echo "1+2" | aplwc-repl +echo "1+2" | aplwc diff --git a/tests/scripts/good/3.aplwc b/tests/scripts/good/3.aplwc index 7a6c0c5..50f8ca5 100755 --- a/tests/scripts/good/3.aplwc +++ b/tests/scripts/good/3.aplwc @@ -1,3 +1,3 @@ -#!/usr/bin/env aplwc-repl +#!/usr/bin/env aplwc -:export plus minus foo
\ No newline at end of file +:export plus minus foo diff --git a/tests/scripts/good/3.sh b/tests/scripts/good/3.sh index 4a86c11..93f52d6 100755 --- a/tests/scripts/good/3.sh +++ b/tests/scripts/good/3.sh @@ -2,7 +2,7 @@ set -e -cat <<EOF | aplwc-repl +cat <<EOF | aplwc 1+2 3+4 EOF diff --git a/tests/scripts/good/4.sh b/tests/scripts/good/4.sh index b075ac7..c3c6160 100755 --- a/tests/scripts/good/4.sh +++ b/tests/scripts/good/4.sh @@ -2,7 +2,7 @@ set -e -cat <<EOF | aplwc-repl +cat <<EOF | aplwc 'abc' 123 EOF diff --git a/tests/scripts/good/5.sh b/tests/scripts/good/5.sh index 28a4734..60c6860 100755 --- a/tests/scripts/good/5.sh +++ b/tests/scripts/good/5.sh @@ -1,4 +1,4 @@ #!/bin/sh export APLWC_SIMULATE_FAILURE_AT=one -aplwc-repl -x +aplwc -x diff --git a/tests/scripts/good/6.sh b/tests/scripts/good/6.sh index 822ff68..a5d8bfc 100755 --- a/tests/scripts/good/6.sh +++ b/tests/scripts/good/6.sh @@ -1,4 +1,4 @@ #!/bin/sh export APLWC_SIMULATE_FAILURE_AT= -aplwc-repl -x +aplwc -x diff --git a/tests/scripts/good/7.sh b/tests/scripts/good/7.sh index d59b189..7f2794d 100755 --- a/tests/scripts/good/7.sh +++ b/tests/scripts/good/7.sh @@ -2,4 +2,4 @@ set -e -echo "'abc'" | aplwc-repl +echo "'abc'" | aplwc diff --git a/tests/scripts/simfail.sh b/tests/scripts/simfail.sh index fe64a25..c10a7cb 100755 --- a/tests/scripts/simfail.sh +++ b/tests/scripts/simfail.sh @@ -5,6 +5,10 @@ set -e export APLWC_SIMULATE_FAILURE_PRINT_COUNT=1 N=$($1 3>&1 1>/dev/null 2>/dev/null) n=1 +if [ -z "$N" ]; then + N=0 +fi + export APLWC_SIMULATE_FAILURE_PRINT_COUNT=0 while [ "$n" -le "$N" ] |