fluffos/testsuite/single/tests/std/break_string.lpc
Yucong Sun 592dfc0688 Prefer .lpc source extension; rename testsuite to .lpc
Source resolution is now explicit-extension-exact: load_object("/foo.c")
probes only foo.c, never foo.lpc (and vice versa); extension-less names
prefer .lpc and fall back to .c. Object identity stays extension-blind:
object names carry no extension, any spelling finds a loaded object, and
the registry is consulted before the filesystem. The caller's raw
spelling now flows through find_object()/inherit/master/simul_efun loads
instead of being pre-stripped away.

- filename_to_obname and otable basename() strip .lpc too (children())
- save_object() strips either source extension before appending .o
- replace_program()/function_exists() handle both suffixes
- testsuite: all LPC sources renamed to .lpc; runner globs, master
  get_include_path cases, and program-name assertions updated;
  README.md rewritten with the extension rules and suite conventions
- new single/tests/efuns/dual_extension.lpc pins exact-pick, fallback,
  no-crossover, identity, and registry-before-filesystem with .c/.lpc
  fixture pairs in /clone

Verified: ctest 297/297 and driver-autotest x3 (ASan Debug) plus
RelWithDebInfo ctest + autotest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:48:48 -04:00

30 lines
1.1 KiB
Text

#include "/std/break_string.h"
void do_tests() {
ASSERT_EQ("This is a longer text.\n"
"Just as an example.\n",
break_string("This is a longer text. Just as an example.", 26));
ASSERT_EQ("Wargon says: It looks like\n"
"Wargon says: this with indent\n",
break_string("It looks like this with indent", 30, "Wargon says: "));
ASSERT_EQ("Wargon says: It looks like\n"
" this with indent\n",
break_string("It looks like this with indent", 30, "Wargon says: ", BS_INDENT_ONCE));
ASSERT_EQ(" It looks like this with\n"
" spaces\n",
break_string("It looks like this with spaces", 30, 2));
ASSERT_EQ("Wargon says: I want it\n"
"Wargon says: but pre-formatted!\n",
break_string ("I want it\nbut pre-formatted!", 60,
"Wargon says: ", BS_LEAVE_MY_LFS));
ASSERT_EQ("Wargon says: \n"
" I want it\n"
" but pre-formatted!\n",
break_string ("I want it\nbut pre-formatted!", 30,
"Wargon says: ", BS_LEAVE_MY_LFS | BS_PREPEND_INDENT));
}