Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port utils::convert_text() and UTF-8 <-> locale converters to Rust #1455

Merged
merged 12 commits into from
Feb 1, 2021

Commits on Jan 28, 2021

  1. Add rudimentary tests for utils::translit()

    I don't see a way to make the testing any more thorough, as we're
    basically testing the platform's support for transliteration — there is
    nothing our tests can do to enable or disable that support.
    Minoru committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    93f2117 View commit details
    Browse the repository at this point in the history
  2. Port utils::translit() tests to Rust

    They all pass, even with a dummy implementation that just returns
    `tocode`. I'll ameliorate that in the next commit.
    Minoru committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    cd01c21 View commit details
    Browse the repository at this point in the history
  3. Test equivalence of C++ and Rust translit() implementations

    This test currently fails, because Rust has a dummy implementation.
    As a reminder: we can't rely on conventional tests here because
    translit() is platform-independent, and there's no fixed known-good
    output for any given input. But we can compare two implementations to
    see if they behave the same — which is exactly what the test is doing.
    Minoru committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    4577eed View commit details
    Browse the repository at this point in the history
  4. Port utils::translit() to Rust

    The "comparison test" which compares results of C++ and Rust
    implementations now pass, and will be removed in the next commit.
    
    This commit passed the CI, i.e. it works not just on my Linux machine,
    but also on Ubuntu Linux with various compilers, two macOS versions, and
    two FreeBSD versions.
    Minoru committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    1236f1c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a4428c3 View commit details
    Browse the repository at this point in the history
  6. Stop leaking iconv_t value in utils::translit

    The inner call to iconv_open() creates a separate iconv_t value which is
    never deallocated. The impact of this is minuscule, since Newsboat runs
    through this code path at most once, but it's still nice to plug this
    little leak.
    Minoru committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    a9bf51e View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2021

  1. Configuration menu
    Copy the full SHA
    52aef2f View commit details
    Browse the repository at this point in the history
  2. Port UTF-8 <-> locale converters to Rust

    Unlike C++ tests, Rust tests don't show output if they pass. As
    a result, the user won't see warnings about the tests that are skipped
    due to missing locales. The next commit will fix that.
    Minoru committed Feb 1, 2021
    Configuration menu
    Copy the full SHA
    9a6dbad View commit details
    Browse the repository at this point in the history
  3. By default, skip Rust tests that require locales

    As mentioned in the previous commit, Rust doesn't display stdout of
    tests which passed. As a result, we can't print a warning if we
    conditionally skip a test.
    
    An interested user can run `cargo test -- --show-output` and see if
    there are any warnings. But this is even worse than our C++ approach: in
    C++ it's sufficient to *look* at the output, but with Rust we'd have to
    *explicitly ask* for that output.
    
    So this commit moves the decision up, to the *invocation of Make*: `make
    check` (and `make ci-check`) runs all the tests *except* the ones that
    need locales, while `make NEWSBOAT_RUN_IGNORED_TESTS=1 check` runs
    *everything* (ditto for `ci-check`). This way, users and package
    builders can continue to run `make check` even if they don't have all
    the locales, and our CI can run a more strict version that checks
    everything.
    Minoru committed Feb 1, 2021
    Configuration menu
    Copy the full SHA
    e5f83bd View commit details
    Browse the repository at this point in the history
  4. Move hackers guide to doc/internal

    It's not a user-facing documentation.
    Minoru committed Feb 1, 2021
    Configuration menu
    Copy the full SHA
    e22254c View commit details
    Browse the repository at this point in the history
  5. Revive the Newsboat hacker's guide

    Most of it is (rightfully) marked as outdated, but the section on tests
    explains the purpose of `NEWSBOAT_RUN_IGNORED_TESTS` variable that
    I introduced a few commits ago.
    Minoru committed Feb 1, 2021
    Configuration menu
    Copy the full SHA
    cc6e75c View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4555cc2 View commit details
    Browse the repository at this point in the history