From 0cf9643be87d93131d36d489b059d694e231fb9b Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Sat, 8 Aug 2026 20:21:43 +0900 Subject: [PATCH] lib: move strconv tests into the package dir (Go layout) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lib/strconv/test/ was the last _test layout deviating from Go's in-package shape (src/bytes/bytes_test.go declares bytes_test in the package dir). Its rationale — `import strconv` file-hitting the sibling strconv.ww — dissolved when #98 made directory packages win over same-named files on any search entry. libbyteid re-paths the three fx entries and drops the covered() carve-out: the completeness scan now keys lib/strconv through the fixtures' dirname. Walk line flips to "ok lib/strconv [strconv_test, external]". --- lib/strconv/{test => }/ftos_test.ww | 8 +------- lib/strconv/{test => }/int_test.ww | 8 +------- lib/strconv/{test => }/stof_test.ww | 6 ------ test/byteid/libbyteid_test.ww | 8 +++----- 4 files changed, 5 insertions(+), 25 deletions(-) rename lib/strconv/{test => }/ftos_test.ww (95%) rename lib/strconv/{test => }/int_test.ww (96%) rename lib/strconv/{test => }/stof_test.ww (95%) diff --git a/lib/strconv/test/ftos_test.ww b/lib/strconv/ftos_test.ww similarity index 95% rename from lib/strconv/test/ftos_test.ww rename to lib/strconv/ftos_test.ww index e5a0c06a..105e5d9f 100644 --- a/lib/strconv/test/ftos_test.ww +++ b/lib/strconv/ftos_test.ww @@ -1,7 +1,5 @@ // ftostest — exercises lib/strconv/ftos.ww (Hare ftos.ha / ftos_ryu.ha -// Ryū port). Run with `out/bin/ww run lib/strconv/test/ftos_test.ww`. -// A failing row aborts via the assert/abort builtin (task #5 @test -// conversion). +// Ryū port). // // Ports ref/hare/strconv/+test/ftos_test.ha's ffmt::G / prec=void / // fflags::NONE rows (the f64tos cases) verbatim — these are exactly @@ -15,10 +13,6 @@ // "pass for both f32 and f64" set, lines 9/183); the _extremes rows mirror // tcsf32 (ftos_test.ha:218-221, the f32-EXCLUSIVE denormal/min/max — full // f32 mantissa). f32 values use the `f32` literal suffix or f32frombits. -// -// Lives in lib/strconv/test/ so `import strconv` resolves to the -// DIRECTORY (full package), not the strconv.ww FILE — same rationale as -// stoftest/decimaltest. package strconv_test; diff --git a/lib/strconv/test/int_test.ww b/lib/strconv/int_test.ww similarity index 96% rename from lib/strconv/test/int_test.ww rename to lib/strconv/int_test.ww index 264e084e..76027e5a 100644 --- a/lib/strconv/test/int_test.ww +++ b/lib/strconv/int_test.ww @@ -1,7 +1,5 @@ // inttest — exercises lib/strconv integer parse: parseint / stoi64 / -// stou64 / the iN/uN width wrappers. Run with -// `out/bin/ww run lib/strconv/test/inttest.ww`. A failing row aborts via -// the assert/abort builtin (task #5 @test conversion). +// stou64 / the iN/uN width wrappers. // // Verbatim port of ref/hare/strconv/stoi.ha:56-86 (stoi/stoi_bases) and // stou.ha:116-138 (stou/stou_bases). Hare's strconv integer tests are @@ -10,10 +8,6 @@ // verbatim ports). The leading id arg to each check helper is retained // to keep the rows 1:1 but is now inert (signalled plumbing removed, task #5). // -// Lives in lib/strconv/test/ (not lib/strconv/) so `import strconv` -// resolves to the lib/strconv DIRECTORY (pulls the full package), not -// the strconv.ww FILE — same rationale as 922_decimal_run. -// // Hex/oct/bin expected values are written in decimal (ww has no 0x/0o/0b // literal form for the expectation side); the original Hare radix form // is noted inline. diff --git a/lib/strconv/test/stof_test.ww b/lib/strconv/stof_test.ww similarity index 95% rename from lib/strconv/test/stof_test.ww rename to lib/strconv/stof_test.ww index c4b9dc9e..e7efbc69 100644 --- a/lib/strconv/test/stof_test.ww +++ b/lib/strconv/stof_test.ww @@ -1,6 +1,4 @@ // stoftest — exercises lib/strconv/stof.ww (Hare stof.ha port). -// Run with `out/bin/ww run lib/strconv/test/stoftest.ww`. A failing row -// aborts via the assert/abort builtin (task #5 @test conversion). // // Ports ref/hare/strconv/stof.ha's @test vectors (stof64 / stof32 / // stofhex). Comparisons are BIT-level (math.f64bits / f32bits) so a @@ -9,10 +7,6 @@ // f64frombits(INF_BITS) (ww math has no NAN/INF f32/f64 const — see // math/floats.ww). Hex extremes (Hare's math::F64_MAX_NORMAL etc., // absent in ww math) assert against the IEEE-754 bit patterns directly. -// -// Lives in lib/strconv/test/ so `import strconv` resolves to the -// DIRECTORY (full package: strconv.ww + decimal.ww + stof_data.ww + -// stof.ww), not the strconv.ww FILE — same rationale as decimaltest. package strconv_test; diff --git a/test/byteid/libbyteid_test.ww b/test/byteid/libbyteid_test.ww index 273a1008..b4c119b6 100644 --- a/test/byteid/libbyteid_test.ww +++ b/test/byteid/libbyteid_test.ww @@ -124,9 +124,9 @@ fn corpus() []ent = { append(es, pr("package main;\nimport os.exec;\nfn main() i32 = { return 0; };\n", "package exec;", "lib/os/exec")); append(es, fx("lib/regex/regex_test.ww")); - append(es, fx("lib/strconv/test/ftos_test.ww")); - append(es, fx("lib/strconv/test/stof_test.ww")); - append(es, fx("lib/strconv/test/int_test.ww")); + append(es, fx("lib/strconv/ftos_test.ww")); + append(es, fx("lib/strconv/stof_test.ww")); + append(es, fx("lib/strconv/int_test.ww")); // strings' families share helpers_test.ww (B3 split) — the // single-file roots dissolved; the composed package is the root. append(es, dx("lib/strings")); @@ -188,8 +188,6 @@ fn covered() []str = { append(cs, "lib/math"); append(cs, "lib/rt"); append(cs, "lib/types"); - // module body dragged into the lib/strconv/test fixtures - append(cs, "lib/strconv"); // #17: the @test runner is AUTO-BUNDLED into every -T sep build, // so every @test fixture byte-ids it cs/ww; 911_attest_record // also compares it directly. It has no _test.ww of its own.