From cb355815eec74ae7e7977ff23f2a4ac7c0b0e333 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 10 Jan 2026 08:37:09 -0600 Subject: [PATCH] Turn on strict linting in test suite. --- src/core/compile.c | 2 +- test/helper.janet | 5 ++++- test/suite-compile.janet | 2 ++ test/suite-ffi.janet | 2 +- test/suite-filewatch.janet | 4 ++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/core/compile.c b/src/core/compile.c index 75e777d7..40d2c3e4 100644 --- a/src/core/compile.c +++ b/src/core/compile.c @@ -538,7 +538,7 @@ void janetc_throwaway(JanetFopts opts, Janet x) { int32_t mapbufstart = janet_v_count(c->mapbuffer); janetc_scope(&unusedScope, c, JANET_SCOPE_UNUSED, "unusued"); janetc_value(opts, x); - janetc_lintf(c, JANET_C_LINT_STRICT, "dead code, consider removing %.2q", x); + janetc_lintf(c, JANET_C_LINT_STRICT, "dead code, consider removing %.4q", x); janetc_popscope(c); if (c->buffer) { janet_v__cnt(c->buffer) = bufstart; diff --git a/test/helper.janet b/test/helper.janet index f717fe5a..c0b89b78 100644 --- a/test/helper.janet +++ b/test/helper.janet @@ -1,5 +1,8 @@ # Helper code for running tests +# Turn on strict linting by default in test suite. +(put root-env *lint-warn* :strict) + (var num-tests-passed 0) (var num-tests-run 0) (var suite-name 0) @@ -7,7 +10,7 @@ (var skip-count 0) (var skip-n 0) -(def is-verbose (os/getenv "VERBOSE")) +(var is-verbose (os/getenv "VERBOSE")) (defn- assert-no-tail "Override's the default assert with some nice error handling." diff --git a/test/suite-compile.janet b/test/suite-compile.janet index 96326ad4..b3c280b0 100644 --- a/test/suite-compile.janet +++ b/test/suite-compile.janet @@ -46,8 +46,10 @@ # Edge case should cause old compilers to fail due to # if statement optimization # 17283241 +(setdyn *lint-warn* :relaxed) (var var-a 1) (var var-b (if false 2 (string "hello"))) +(setdyn *lint-warn* nil) (assert (= var-b "hello") "regression 1") diff --git a/test/suite-ffi.janet b/test/suite-ffi.janet index 45bcd0ae..73e8e07a 100644 --- a/test/suite-ffi.janet +++ b/test/suite-ffi.janet @@ -21,7 +21,7 @@ (import ./helper :prefix "" :exit true) (start-suite) -(def has-ffi (dyn 'ffi/native)) +(var has-ffi (dyn 'ffi/native)) (def has-full-ffi (and has-ffi (when-let [entry (dyn 'ffi/calling-conventions)] diff --git a/test/suite-filewatch.janet b/test/suite-filewatch.janet index 1c77fa65..fb5e3894 100644 --- a/test/suite-filewatch.janet +++ b/test/suite-filewatch.janet @@ -24,8 +24,8 @@ (assert true) (def chan (ev/chan 1000)) -(def is-win (or (= :mingw (os/which)) (= :windows (os/which)))) -(def is-linux (= :linux (os/which))) +(var is-win (or (= :mingw (os/which)) (= :windows (os/which)))) +(var is-linux (= :linux (os/which))) # If not supported, exit early (def [supported msg] (protect (filewatch/new chan)))