Add Url/Html encoding, ISO-8601 interval parse, TempFile, random_string charset

Universal additions (all generic, header-only, tested; full suite 1127 pass):
- Void::Encoding::Url — RFC 3986 percent encode/decode + query_encode.
- Void::Text::html_unescape — numeric + common named HTML entities -> UTF-8.
- Void::Time::parse_iso8601_interval — parse PT#H#M#S / P#DT#H#M#S durations
  (distinct from the unit-suffix parse_duration).
- Void::FileSystem::TempFile — RAII unique temp file (alongside TempDir),
  with keep() to persist.
- Void::Random::random_string(n, charset) overload.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 4.8 committed 2026-06-22 16:15:01 +03:00
1 parent 80293ee56f
commit fb0506581f
9 files changed
+645 -6

No files matched your search

+43
View File
@@ -9,6 +9,49 @@
// ── Stopwatch ─────────────────────────────────────────────────────────────
// ── ISO 8601 interval parsing ─────────────────────────────────────────────
Void::Testing::Test iso8601_interval_hours_minutes()
{
const auto r = Void::Time::parse_iso8601_interval("PT1H30M");
Void::Testing::expect(r.has_value());
Void::Testing::expect_eq(r->count(), static_cast<long long>(5400));
}
Void::Testing::Test iso8601_interval_days_and_time()
{
const auto r = Void::Time::parse_iso8601_interval("P1DT2H");
Void::Testing::expect(r.has_value());
Void::Testing::expect_eq(r->count(), static_cast<long long>(93600));
}
Void::Testing::Test iso8601_interval_seconds_only()
{
const auto r = Void::Time::parse_iso8601_interval("PT45S");
Void::Testing::expect(r.has_value());
Void::Testing::expect_eq(r->count(), static_cast<long long>(45));
}
Void::Testing::Test iso8601_interval_zero_and_negative()
{
const auto z = Void::Time::parse_iso8601_interval("PT0S");
Void::Testing::expect(z.has_value());
Void::Testing::expect_eq(z->count(), static_cast<long long>(0));
const auto n = Void::Time::parse_iso8601_interval("-PT1M");
Void::Testing::expect(n.has_value());
Void::Testing::expect_eq(n->count(), static_cast<long long>(-60));
}
Void::Testing::Test iso8601_interval_malformed()
{
Void::Testing::expect(!Void::Time::parse_iso8601_interval("").has_value());
Void::Testing::expect(
!Void::Time::parse_iso8601_interval("1H30M").has_value());
Void::Testing::expect(!Void::Time::parse_iso8601_interval("PT").has_value());
Void::Testing::expect(
!Void::Time::parse_iso8601_interval("PT5X").has_value());
}
Void::Testing::Test stopwatch_elapsed_is_non_negative()
{
auto sw = Void::Time::Stopwatch::started();