Replace meval with evalexpr, add tests and CI (0.1.12)#2
Merged
Conversation
meval 0.2 is unmaintained and pulled in an ancient nom 1.2 that triggers a future-incompatibility warning. Switch the calculator to the actively maintained evalexpr crate, removing that warning. evalexpr differs from meval in two ways that matter for a calculator, both handled here to preserve the existing behaviour: - Integer operands use integer division (5/2 == 2). Bare integer literals are coerced to floats before evaluation so arithmetic behaves like a calculator (5/2 == 2.5). Digits that belong to identifiers (e.g. the 10 in log10) or decimal literals (3.14) are left untouched. - Math functions are only exposed under a math:: namespace and there are no math constants. A custom evaluation context registers the familiar bare names (sqrt, sin, cos, tan, ln, log, log2, log10, exp, abs, floor, ceil, round, pow, ...) and the constants pi, e and tau. Division by zero still yields Infinity, matching the previous f64 behaviour. Added unit tests covering literal floatification, arithmetic, functions, constants and error handling. https://claude.ai/code/session_01B33sAdjSZQQ6XRtFkxYTAb
Expands test coverage beyond the calculator: - applications: AppSource detection, .desktop parsing (including NoDisplay / missing-Exec skips), bulk loading from an extra dir, and query matching (by name, by id, no-match, empty-query truncation) - config: defaults, TOML round-trip, and serde fallback for partial/empty configs - providers: Item builder and Item/ProviderInfo -> protobuf conversions - manager: provider registration, score-based combining/sorting, max_results truncation, explicit-provider filtering, and prefix routing (via a mock provider) - server: end-to-end query and list-providers round-trips over a real Unix socket Adds .github/workflows/ci.yml running fmt check, build and test on pushes to main and on pull requests (installs protoc and uses --locked). https://claude.ai/code/session_01B33sAdjSZQQ6XRtFkxYTAb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related changes:
meval→evalexpr.meval 0.2is unmaintained and pulled in an ancientnom 1.2that triggered a future-incompatibility warning. Switched to the actively maintainedevalexpr, removing that warning.Calculator behaviour preserved
evalexprdiffers frommevalin two ways that matter for a calculator; both are handled so existing expressions keep working:evalexprdoes integer division for integer operands (5/2 == 2). Bare integer literals are coerced to floats before evaluation so arithmetic behaves like a calculator (5/2 == 2.5). Digits that belong to identifiers (the10inlog10) or decimal literals (3.14) are left untouched.evalexpronly exposes math functions under amath::namespace and ships no math constants. A custom evaluation context registers the familiar bare names (sqrt,sin,cos,tan,ln,log,log2,log10,exp,abs,floor,ceil,round,pow, ...) and the constantspi,e,tau.Division by zero still yields
Infinity, matching the previous f64 behaviour.Tests
cargo testnow runs 30 tests:AppSourcedetection,.desktopparsing (incl.NoDisplay/ missing-Execskips), bulk loading from an extra dir, query matching (name, id, no-match, empty-query truncation)Itembuilder andItem/ProviderInfo→ protobuf conversionsmax_resultstruncation, explicit-provider filtering, prefix routing (via a mock provider)CI
Adds
.github/workflows/ci.yml— on pushes tomainand on PRs it installsprotoc, then runscargo fmt --check,cargo build --locked, andcargo test --locked.Verification
cargo build --release --locked✅cargo test✅ (30 passed)cargo fmt --all -- --check✅mevaland the oldnom 1.2are gone fromCargo.lock; future-incompat warning resolvedBumps version to 0.1.12 (
Cargo.toml+datacube.spec).https://claude.ai/code/session_01B33sAdjSZQQ6XRtFkxYTAb