Skip to content

Add unit tests and apply clippy recommendations#30

Open
AlejandroMinaya wants to merge 3 commits intoDVDTSB:mainfrom
AlejandroMinaya:main
Open

Add unit tests and apply clippy recommendations#30
AlejandroMinaya wants to merge 3 commits intoDVDTSB:mainfrom
AlejandroMinaya:main

Conversation

@AlejandroMinaya
Copy link

Clippy fixes

Minor code quality improvements flagged by cargo clippy:

  • events.rs: return ();return
  • render.rs: removed redundant usize cast and trailing .into() on an already-compatible type
  • utils.rs: >= self.data.len() + 1> self.data.len() (equivalent, idiomatic)
  • config.rs: if/else on Resultmatch; nested if let blocks → let-chains (if let A && let B)

Unit tests (45 tests, 0 new dependencies)

Tests are added inline (#[cfg(test)]) to the four pure-logic modules. TUI-dependent modules
(render.rs, events.rs, state.rs) are excluded as they require a live terminal.

File Tests
src/byte.rs ByteType classification for all 5 variants, get_hex(), value()
src/config.rs toml_value_to_color() for named/index/RGB + error cases, read_config() with missing file, Config::default()
src/app/change.rs do_change/undo/redo for Edit, Insert, and Delete variants
src/app/utils.rs get_idx/set_idx, all cursor movement, buffer ops, afreplace/insert/delete_data, selection_range

cargo test passes locally with all 45 tests green.

AlejandroMinaya and others added 3 commits March 21, 2026 18:53
Adds 45 unit tests across the four pure-logic source files (byte.rs,
config.rs, app/change.rs, app/utils.rs), covering byte classification,
color parsing, undo/redo, cursor navigation, buffer ops, and data
mutation.

✻  Generated with Claude Code
test: Add unit tests for byte, config, change, and utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant