2
0
mirror of https://github.com/boostorg/locale.git synced 2026-01-19 16:32:09 +00:00

39 Commits

Author SHA1 Message Date
Alexander Grund
e540a63c0b Enable char8_t strings where available, remove Clang condition
The issue was caused by using an incompatible libstdc++.
For Clang 13 & 14 libstdc++ 11 works.
2025-01-10 13:33:10 +01:00
Alexander Grund
5a58e65bda Remove superflous subfolders of src
The shorter paths make the sources easier to navigate.

Basically revert of #99 / f44b3bb771
after the underlying issue is resolved.
2025-01-10 12:50:45 +01:00
Alexander Grund
ec1676280e Raise minimum ICU version to 4.8.1
A lot of checks and a major workaround are for ICU 4.8 or earlier which
can be removed.
An annoying bug (Parsing of timezones like "GMT" in "full" format followed by unrelated text)
fixed in 4.8.1 is worth avoiding by requiring this version over 4.8.0.
2024-12-27 12:14:43 +01:00
Alexander Grund
f29d950d80 Fix type confusion with boost::locale::collator
The class derived from `std::collate` which is always present in `std::locale`.
So checks for the `boost::locale::collator` facet may return wrongly true.
As a fix make this an independent facet with its own ID.
Use an adapter such that a std::collate derived class can use its abilities.
2024-02-07 20:14:39 +01:00
Alexander Grund
2b7d66e408 Add test checking for boost::locale::collator
Reproducer for crash due to type confusin as reported in
https://github.com/boostorg/locale/issues/210#issuecomment-1876819426
2024-02-07 17:41:09 +01:00
Alexander Grund
6e8a77b31c Add missing test cases for info-class 2023-09-16 17:13:39 +02:00
Alexander Grund
324a66752b Use dedicated macro to check availability of std::basic_string<char8_t>
Allow to disable for non-conforming compilers/stdlibs
2023-09-13 09:20:05 +02:00
Alexander Grund
efed993fae Check for availability of std::string<char8_t> 2023-09-12 13:18:28 +02:00
Alexander Grund
238ba9e2e9 Remove support for codecvt<char8_t
std libraries don't provide the required support
(e.g. missing VTables or facet IDs)
2023-09-12 10:07:45 +02:00
Alexander Grund
0faa3c10cc Add implementations for char8_t where available
Allows to e.g. convert `std::u8string`s, translate them and run boundary
analysis.
Formatting isn't possible due to lack of facets
(more specifically: their IDs) in the standard libraries
2023-09-12 10:07:45 +02:00
Alexander Grund
26469cd230 Suppress or handle missing coverage of test code
Try to achieve 100% test code coverage to find accidentally missed ones.
Especially the WinAPI tests had some wrongly uncovered lines at function
start/end which needed to be excluded.
2023-06-27 23:04:08 +02:00
Alexander Grund
2fe203055f Factor out (conditional) has_win_locale in tests
Only call into library code when the function is available.
That check was missed in one test so put the same code into a single place.

Fixes #181
2023-06-18 09:45:25 +02:00
Alexander Grund
c823f3a893 Merge pull request #179 from Flamefire/test
Improve tests and deprecate `localization_backend_manager::get`
2023-06-14 09:30:32 +02:00
Alexander Grund
30987bbd02 Fix test failure with WinAPI backend which ignores use_ansi_encoding
Also test generator stuff for all backends and small refactoring of the
win_backend code
2023-06-13 18:08:19 +02:00
Alexander Grund
6dd2abc5b1 Add test for use_ansi_encoding 2023-06-13 11:33:22 +02:00
Alexander Grund
d64f588875 Replace localization_backend_manager::get by ...::create
Carry the intention better reducing the old 3 methods to 1.

Also remove unimplemented but defined functions from `generator`.
2023-06-13 11:14:40 +02:00
Alexander Grund
6bf68d83ce Add test for the char-type argument of backend::install
Make sure it is used when it should and ignored when it shouldn't.
2023-06-13 11:05:24 +02:00
Alexander Grund
1be9d99566 Add fallback if UTF-8 locale cannot be loaded
Check if locale without (the UTF-8) encoding exists and use that with
`utf8_support::from_wide` before failing.
2023-06-08 18:44:43 +02:00
Alexander Grund
904d18a9f6 Test generated facets for different locales
Allow to catch cases where the facet is only generated for e.g. UTF-8
2023-05-28 12:22:14 +02:00
Alexander Grund
6a95c82083 Simplify tests with empty_stream
Add a function to clear a string stream (i.e. make it empty)
and use it instead of `s.str(some-templated-empty-string)`
2023-05-26 19:35:36 +02:00
Alexander Grund
fcf50b5262 Make std backend fall back to classic locale instead of system locale
Partial fix of #172
2023-05-24 17:00:37 +02:00
Alexander Grund
9b1813e757 Remove superflous braces
Make the code a bit shorter vertically, enforced formating ensures
correct indentation which provides enough readability
2023-05-16 12:04:59 +02:00
Alexander Grund
428cc467b3 Add test for localization_backend_manager::get_all_backends and use it in tests
Avoid the conditional checks in every 2nd test.
2023-05-03 21:11:46 +02:00
Alexander Grund
3d29a20322 Refactor: Make (better) use of have_locale and rename to has_posix_locale 2023-03-01 17:10:28 +01:00
Alexander Grund
0d561a6153 Add tests for en_001/en_150 formatting 2023-03-01 17:09:47 +01:00
Alexander Grund
f6f897b413 locale_data: Uppercase encoding
Yield a uniform result, e.g. UTF-8.
This now matches the documentation as previously `boost::locale::info::encoding()`
returned "utf-8" instead of the documented "UTF-8".
2023-02-18 18:56:55 +01:00
Alexander Grund
3609eca8b2 Make use of enhanced test macros
Use the TEST-macros that print the values on mismatch to aid debugging
2023-01-10 14:45:07 +01:00
Alexander Grund
e5ed439ea3 Use enum classes for facet types
Changes `character_facet_type` & `locale_category_type` to the enum classes `char_facet_t` & `category_t`
This avoids a name clash with e.g. `calendar_facet` but is a breaking change
2022-10-24 20:01:12 +02:00
Alexander Grund
fa4afd7a5d Switch to consistent west-const
Especially for `const char*` which seems to be more common than `char const*`
2022-10-10 14:25:58 +02:00
Alexander Grund
7784f46243 Format sources
Use clang-format-14 to format source code consistently.
Closes #98
2022-10-10 14:25:58 +02:00
Alexander Grund
5a535285cd FORMATTING: Reduce amount of whitespace 2022-09-14 19:37:58 +02:00
Alexander Grund
fadb2190ce Move test headers to subfolder
Gets rid of the `test_` prefix in the filenames and avoids confusing those with the actual tests especially by renaming the test framework file from `test_locale.hpp` to `unit_test.hpp`
2022-09-13 12:50:23 +02:00
Alexander Grund
707f801c55 Remive vim markers
To be replaced by clang-format in the future.
2022-07-12 18:35:42 +02:00
Alexander Grund
595934f25e Update license headers
Use the more concise format omitting the reference to the license file
and refer to the URL only.
2022-07-12 18:35:41 +02:00
Alexander Grund
aa30bd33aa Refactor test framework
Use a common `main` function calling into custom `test_main` functions and
move all common code into the former.
Also introduce an RAII class for a `locale_t` to avoid leaks and reduce
the code further.
Add some LCOV annotations for lines not expected to be reached.
2022-06-30 15:08:08 +02:00
Alexander Grund
d1fc12426f Remove trailing spaces 2022-06-04 11:50:39 +02:00
Artyom Beilis
48ff4519b8 - Updates according to library requirements
- cleanup of inspect warnings
  - various requiremets like libraries.htm and maintainers.txt


[SVN r73786]
2011-08-15 19:04:34 +00:00
Artyom Beilis
545df3e27d merged changeset 1887 - generator should be tested regardless of backends
[SVN r73094]
2011-07-14 09:01:50 +00:00
Artyom Beilis
4c30e01d23 First Version of Boost.Locale integrated into SVN trunk
[SVN r73017]
2011-07-12 13:57:36 +00:00