Andrew Borodin
2893ee212f
Add tests for edit_replace_cmd().
...
* (status_msg_init): add MC_MOCKABLE attribute.
* (status_msg_deinit): likewise.
* (edit_search_update_callback): likewise.
* (edit_dialog_replace_show): add MC_MOCKABLE and make public.
* (edit_dialog_replace_prompt_show): likewise.
* (edit_search_options): make public.
* (B_REPLACE_ALL, B_REPLACE_ONE, B_SKIP_REPLACE): likewise.
* (macros_list): init explicitly.
* tests/src/editor/mc.charsets: add ASCII charset.
* tests/src/editor/edit_replace_cmd.c: new file.
* tests/src/editor/Makefile.am: add new test.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru >
2025-02-23 18:52:47 +03:00
Yury V. Zaytsev
ac9a81d9bd
Ticket #4642 : extract and re-implement str_chomp to fix buffer overflow, add tests
...
Found in Alpine/musl on s390x, confirmed on aarch64 using valgrind - introduced
in 65a7278d8a :
{{{
==156518== Invalid read of size 1
==156518== at 0x413BE0: vfs_parse_ls_lga (parse_ls_vga.c:863)
==156518== by 0x4076C3: process_ls_line (mc_parse_ls_l.c:350)
==156518== by 0x4076C3: process_input (mc_parse_ls_l.c:376)
==156518== by 0x40736B: main (mc_parse_ls_l.c:404)
==156518== Address 0x536be6f is 1 bytes before a block of size 2 alloc'd
==156518== at 0x48854F0: malloc (vg_replace_malloc.c:446)
==156518== by 0x4CF4FCB: g_malloc (gmem.c:100)
==156518== by 0x4D0E99B: g_strdup (gstrfuncs.c:323)
==156518== by 0x413887: g_strdup_inline (gstrfuncs.h:321)
==156518== by 0x413887: vfs_parse_ls_lga (parse_ls_vga.c:848)
==156518== by 0x4076C3: process_ls_line (mc_parse_ls_l.c:350)
==156518== by 0x4076C3: process_input (mc_parse_ls_l.c:376)
==156518== by 0x40736B: main (mc_parse_ls_l.c:404)
}}}
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/79071
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2025-02-03 10:54:51 +01:00
Yury V. Zaytsev
8406bddbd4
formatting: step 6 - manual tweaks
...
* Reformat tests with magic comma
* Remove macro guards causing unstable formatting
```
find . -type file -name '*.[ch]' | xargs sed -i '' -E 's|# *endif.+//.+$|#endif|g'
```
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2025-02-02 19:38:47 +01:00
Yury V. Zaytsev
c3ff1763f6
formatting: step 4 - reformat all files with make indent
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2025-02-02 19:38:47 +01:00
Yury V. Zaytsev
bc4da2a92d
formatting: step 2.1 - remove indent control comments
...
```
master % find . -type file -name '*.[ch]' | xargs sed -i '' '/INDENT-ON/d'
master % find . -type file -name '*.[ch]' | xargs sed -i '' '/INDENT-OFF/d'
```
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2025-02-02 19:16:54 +01:00
Yury V. Zaytsev
851a1a2dae
Ticket #4592 : migrate to clang-format - step 1: convert comments /* */ -> //
...
"Safe" automatic replacement and then manual tweaks:
```
find . -type file -name '*.[ch]' | xargs sed -i '' -E '/^\/\*/! s|/\*([^/]+)\*/$|//\1|g'
find . -type file -name '*.[ch]' | xargs sed -i '' -E s/ +$//
```
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2025-02-02 19:13:21 +01:00
Yury V. Zaytsev
8cba5f6e51
doc: switch links to https://, update or remove dead links
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2025-01-31 10:12:32 +01:00
Yury V. Zaytsev
24602c3281
Ticket #3147 : implement extfs support for SquashFS
...
Requires squashfs-tools, initial code contributed by Unknown.
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2025-01-25 20:07:06 +01:00
Yury V. Zaytsev
edb53a4fc6
extfs: add test data for torrent plugin
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2025-01-13 09:03:18 +01:00
Andrew Borodin
4b96b8d5f3
Update copyright years.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru >
2025-01-11 12:14:08 +03:00
Yury V. Zaytsev
877ef7d78b
tests: don't free after ck_abort_msg as it's marked no-return
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
22b80bf2d4
tests: fix -Winvalid-source-encoding warnings in path_recode
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
5779e51e69
tests: fix -Winvalid-source-encoding warnings in config_string
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
15eeb94d2c
tests: fix -Wmissing-variable-declarations warnings in vfs tests
...
```
../../../../tests/lib/vfs/vfs_parse_ls_lga.c:39:23: warning: no previous extern declaration for non-static variable 'test_subclass1' [-Wmissing-variable-declarations]
struct vfs_s_subclass test_subclass1;
^
../../../../tests/lib/vfs/vfs_parse_ls_lga.c:42:21: warning: no previous extern declaration for non-static variable 'vfs_root_entry' [-Wmissing-variable-declarations]
struct vfs_s_entry *vfs_root_entry;
^
../../../../tests/lib/vfs/vfs_s_get_path.c:40:23: warning: no previous extern declaration for non-static variable 'test_subclass1' [-Wmissing-variable-declarations]
struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3;
^
```
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
5b63416d04
tests: fix -Wmissing-variable-declarations warnings in filevercmp
...
```
../../../../tests/lib/strutil/filevercmp.c:213:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds2_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds2_len = G_N_ELEMENTS (filevercmp_test_ds2);
^
../../../../tests/lib/strutil/filevercmp.c:250:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds3_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds3_len = G_N_ELEMENTS (filevercmp_test_ds3);
^
../../../../tests/lib/strutil/filevercmp.c:288:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds4_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds4_len = G_N_ELEMENTS (filevercmp_test_ds4);
^
../../../../tests/lib/strutil/filevercmp.c:349:14: warning: no previous extern declaration for non-static variable 'filevercmp_test_ds5_len' [-Wmissing-variable-declarations]
const size_t filevercmp_test_ds5_len = G_N_ELEMENTS (filevercmp_test_ds5);
^
```
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-19 08:56:56 +02:00
Yury V. Zaytsev
93b539444b
Ticket #4584 : re-implement mocking via weak symbols instead of symbol duplication
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-19 08:56:40 +02:00
Andrew Borodin
3da5412999
maint/utils/update-years.sh: add tests/src/vfs/extfs/helpers-list/test_all.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru >
2024-10-05 15:05:58 +03:00
Yury V. Zaytsev
8f723b8a7f
charset: reimplement is_supported_encoding to use iconv instead of mc built-in charset table
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
c079a09612
tests: edit_complete_word_cmd - fix -Winvalid-source-encoding to make it easier to debug
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
1e0e6b5e1e
charset: rename IBM866 to CP866 for iconv and adjust charset names for codeset
...
```
linux $ iconv -l | grep 866
866//
866NAV//
CP866//
CP866NAV//
CSIBM866//
IBM866//
IBM866NAV//
solaris $ iconv -l | grep 866
CP866 (CP866, CP-866, CP_866, 866),
IBM-866,
macos % iconv -l | grep 866
CP866 866 CSIBM866 IBM866 MSCP866
musl/src/locale/codepages.h: "cp866\0"
```
On glibc-based systems, codeset will be set to charmap name, on most other systems it seems to be taken from locale name.
## Linux
```
zaytsev@fedora:~$ locale -a | grep ru
ru_RU
ru_RU.cp866
ru_RU.ibm866
ru_RU.iso88595
ru_RU.koi8r
ru_RU.utf8
russian
ru_UA
ru_UA.koi8u
ru_UA.utf8
zaytsev@fedora:~/src$ LC_ALL=ru_RU.cp866 LANG=ru_RU.cp866 ./a.out
IBM866
zaytsev@fedora:~/src$ LC_ALL=ru_RU.koi8r LANG=ru_RU.koi8r ./a.out
KOI8-R
zaytsev@fedora:~/src$ LC_ALL=ru_RU.iso88595 LANG=ru_RU.iso88595 ./a.out
ISO-8859-5
```
## macOS
```
ru_RU.ISO8859-5
ru_RU.CP866
ru_RU.CP1251
ru_RU.UTF-8
ru_RU.KOI8-R
ru_RU
zaytsev@Yurys-MBP mc % LANG=ru_RU.CP866 LC_ALL=ru_RU.CP866 ./a.out
CP866
zaytsev@Yurys-MBP mc % LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.out
ISO8859-5
```
## FreeBSD
```
ru_RU.CP1251
ru_RU.CP866
ru_RU.ISO8859-5
ru_RU.KOI8-R
ru_RU.UTF-8
zaytsev@cfarm240:~ $ LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.out
ISO8859-5
zaytsev@cfarm240:~ $ LANG=ru_RU.CP866 LC_ALL=ru_RU.CP866 ./a.out
CP866
```
## Solaris
```
ru
ru.UTF-8
ru.koi8-r
ru_RU
ru_RU.ANSI1251
ru_RU.ISO8859-5
ru_RU.KOI8-R
ru_RU.UTF-8
zaytsev@gcc-solaris10:~/src$ LANG=ru_RU.ISO8859-5 LC_ALL=ru_RU.ISO8859-5 ./a.o>
ISO8859-5
zaytsev@gcc-solaris10:~/src$ LANG=ru.koi8-r LC_ALL=ru.koi8-r ./a.out
KOI8-R
```
## AIX
```
zaytsev@gcc111:[/home/zaytsev]locale -a
C
POSIX
en_US.8859-15
en_US.IBM-858
en_US.ISO8859-1
en_US
-bash-5.1$ LANG=en_US.ISO8859-1 LC_ALL=en_US.ISO8859-1 ./a.out
ISO8859-1
```
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
f34e2ae715
tests: use UTF-8 to prevent creation of invalid converters
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
319598df41
tests: path_len - fix assertions, now test should fail
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
8978b7f1d6
Ticket #3972 : fix test harness on Illumos by resolving shellcheck warnings
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-10-05 11:49:26 +02:00
Yury V. Zaytsev
a3ce493ae2
vfs: fix tempdir path building to account for trailing slash on macOS
...
Signed-off-by: Yury V. Zaytsev <yury@shurup.com >
2024-09-03 07:39:25 +02:00
slowpeek
2971db6226
Ticket #4567 : Test fails in iso9660.xorriso in 4.8.32-pre1.
...
xorriso uses different date formats when listing recent (180 days old at max)
and older items. For the test to not fail with time, it is important to NOT have
any "recent" items in the input data.
Closes MidnightCommander/mc#204 .
Signed-off-by: Andrew Borodin <aborodin@vmail.ru >
2024-08-10 20:37:28 +03:00