summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
3 daystest: Add unit tests for music config and org-contacts functionsCraig Jennings
Add comprehensive unit tests for various Emacs Lisp functions, covering M3U file handling, music file validation, and contact capture template finalization: - Tests for appending tracks to M3U files Tests for recursive music - collection Tests for completion table creation Tests for - extracting M3U basenames and files Tests for M3U file parsing - Tests for filename sanitization Tests for directory and file - validity checks Tests for org-contacts capture template - finalization Each test validates normal, boundary, and error conditions. These tests improve code reliability by verifying expected behavior across a range of scenarios.
3 daystest: Add comprehensive test suite for video-audio-recording moduleCraig Jennings
Added 83 test cases across 9 test files with 100% pass rate, covering device detection, parsing, grouping, and complete workflow integration. ## What Was Done ### Refactoring for Testability - Extracted `cj/recording--parse-pactl-output` from `cj/recording-parse-sources` - Separated parsing logic from shell command execution - Enables testing with fixture data instead of live system calls ### Test Fixtures Created - `pactl-output-normal.txt` - All device types (built-in, USB, Bluetooth) - `pactl-output-empty.txt` - Empty output - `pactl-output-single.txt` - Single device - `pactl-output-monitors-only.txt` - Only monitor devices - `pactl-output-inputs-only.txt` - Only input devices - `pactl-output-malformed.txt` - Invalid/malformed output ### Unit Tests (8 files, 78 test cases) 1. **test-video-audio-recording-friendly-state.el** (10 tests) - State name conversion: SUSPENDED→Ready, RUNNING→Active 2. **test-video-audio-recording-parse-pactl-output.el** (14 tests) - Parse raw pactl output into structured data - Handle empty, malformed, and mixed valid/invalid input 3. **test-video-audio-recording-parse-sources.el** (6 tests) - Shell command wrapper testing with mocked output 4. **test-video-audio-recording-detect-mic-device.el** (13 tests) - Documents bugs: Returns ID numbers instead of device names - Doesn't filter monitors (legacy function, not actively used) 5. **test-video-audio-recording-detect-system-device.el** (13 tests) - Works correctly: Returns full device names - Tests monitor detection with various device types 6. **test-video-audio-recording-group-devices-by-hardware.el** (12 tests) - CRITICAL: Bluetooth MAC address normalization (colons vs underscores) - Device pairing logic (mic + monitor from same hardware) - Friendly name assignment - Filters incomplete devices 7. **test-video-audio-recording-check-ffmpeg.el** (3 tests) - ffmpeg availability detection 8. **test-video-audio-recording-get-devices.el** (7 tests) - Auto-detection fallback logic - Error handling for incomplete detection ### Integration Tests (1 file, 5 test cases) 9. **test-integration-recording-device-workflow.el** (5 tests) - Complete workflow: parse → group → friendly names - Bluetooth MAC normalization end-to-end - Incomplete device filtering across components - Malformed data graceful handling ## Key Testing Insights ### Bugs Documented - `cj/recording-detect-mic-device` has bugs (returns IDs, doesn't filter monitors) - These functions appear to be legacy code not used by main workflow - Tests document current behavior to catch regressions if fixed ### Critical Features Validated - **Bluetooth MAC normalization**: Input uses colons (00:1B:66:C0:91:6D), output uses underscores (00_1B_66_C0_91_6D), grouping normalizes correctly - **Device pairing**: Only devices with BOTH mic and monitor are included - **Friendly names**: USB/PCI/Bluetooth patterns correctly identified ### Test Coverage - Normal cases: Valid inputs, typical workflows - Boundary cases: Empty, single device, incomplete pairs - Error cases: Malformed input, missing devices, partial detection ## Test Execution All tests pass: 9/9 files, 83/83 test cases (100% pass rate) ```bash make test-file FILE=test-video-audio-recording-*.el # All pass individually # Integration test also passes make test-file FILE=test-integration-recording-device-workflow.el ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3 daysfeat: Add copy-to-top and copy-to-bottom buffer methods with testsCraig Jennings
Add two new methods to copy buffer content regions: - cj/copy-to-bottom-of-buffer: copies from point to end of buffer - cj/copy-to-top-of-buffer: copies from beginning of buffer to point Reorganize copy operations under C-; b c submenu: - C-; b c w: copy whole buffer - C-; b c t: copy to top (beginning to point) - C-; b c b: copy to bottom (point to end) Other copy operations (buffer name, file path, file link) remain at C-; b base level for quick access. Add comprehensive ERT tests (22 tests total): - test-custom-buffer-file-copy-to-bottom-of-buffer.el (11 tests) - test-custom-buffer-file-copy-to-top-of-buffer.el (11 tests) - Tests cover normal, boundary, and error cases including unicode, narrowing, whitespace, and read-only buffers All tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
6 daysfeat:count-characters: Add character counting functionalityCraig Jennings
Introduce functions to count characters in a buffer or region. Bind new character counting function to "C-; C" in custom keymap.
10 daysrefactor: Rename custom-file-buffer to custom-buffer-fileCraig Jennings
Renamed the module 'custom-file-buffer' to 'custom-buffer-file' to ensure consistency across the codebase. This change affects module imports and test files. Additionally, new module 'system-commands.el' has been created to handle system power and session management commands, removing these functionalities from 'wip.el'.
10 daystest:org-gcal: Add mock tests for API request captureCraig Jennings
Add a new test file `test-org-gcal-mock.el` to mock and capture what org-gcal sends to the Google Calendar API. This enables debugging of sync issues without making real API calls. Includes methods to capture HTTP requests and verify API call details.
11 daysfeat:test-runner: Enhance ERT test runner with focus/unfocus supportCraig Jennings
Add comprehensive documentation and workflow details for the ERT test runner, including integration with Projectile projects for automatic test discovery. Refactor code to support focus/unfocus workflows, allowing developers to efficiently manage test execution by focusing on specific test files. Introduce internal utility functions `cj/test--do-*` to modularize logic for file operations and focus management, improving code maintainability. Add new tests in `test-test-runner.el` to validate the enhanced functionality, ensuring robust handling of focus operations and test execution scenarios.
11 daysfeat:browser-config: Integrate browser configuration and add testsCraig Jennings
- Move `browser-config` from 'Modules In Test' to active modules - Refactor browser handling functions for better error handling: - Introduce `cj/--do-apply-browser-choice` and - `cj/--do-choose-browser` Return status symbols for success and - error cases Add comprehensive unit tests in - `tests/test-browser-config.el` Focus on internal `cj/--do-*` - functions and file I/O using temp files Validate return values and - ensure isolated tests with setup/teardown functions Ensure - consistent handling of browser configurations and improve - initialization logic
11 daysfeat:jumper: Integrate and enhance 'jumper' module with testsCraig Jennings
Enable 'jumper' module by uncommenting its require statement in init.el. Enhance 'jumper' by adding detailed documentation, refactoring logic into internal functions, and updating keybinding setup for better usability. Integrate 'which-key' for improved keybinding assistance. Add comprehensive unit tests for 'jumper' functionalities to ensure reliability.
11 daysfeat:text-generation: improve and rename lorem generatorCraig Jennings
Rename `lorem-generator.el` to `lorem-optimum.el` for fun. Enhance text tokenization, Markov chain learning, and text generation functions. Introduce new configuration variables for training files and improve efficiency with vectorized access. Add comprehensive benchmarks and unit tests under `tests/`. This improves performance and lays groundwork for further extensions.
11 daysfeat:org-contacts: Enhance email parsing and add testsCraig Jennings
Add a new function `cj/--parse-email-string` to parse email strings with multiple formats and separators, ensuring robust handling of real-world email variations. This commit also includes extensive tests for the new parsing function, covering normal, edge, and special cases, ensuring comprehensive test coverage and reliability.
11 daysfeat:org-webclipper: Add smart heading adjustmentCraig Jennings
Introduce `cj/--process-webclip-content` to enhance webclip processing by removing the first heading and demoting subsequent headings, preserving page structure. Includes tests for thorough validation of the new functionality.
11 dayschore:init.el: update comments and modules loading statusCraig Jennings
Refined comments to note completion of module tests. Removed outdated function and disabled a module. Adjusted 'org-roam-config' for test addition.
11 dayschore:org-agenda: Remove outdated test file and unused codeCraig Jennings
Deleted `test-custom-org-agenda-functions.el.disabled` as it was obsolete. Removed commented-out global keybinding in `org-agenda-config.el` for clarity.
11 daysfeat:org-roam-config: Add new utilities and testsCraig Jennings
Introduce several utility functions for org-roam configuration, including `cj/--generate-roam-slug`, `cj/--demote-org-subtree`, and `cj/--format-roam-node`. These enhance title-to-slug conversion, subtree demotion, and node file formatting. Additionally, include comprehensive test cases for these functions to ensure correctness and reliability in various scenarios.
11 daysfeat:text-enclose): Enhance text enclosure: new functions and testsCraig Jennings
Add line manipulation utilities: `append-to-lines`, `prepend-to-lines`, `indent-lines`, and `dedent-lines`. Add tests for these functions and improve existing text wrapping functionalities with `wrap`, `unwrap`, and `surround` implementations. Extend keymap for easier access to these functions.
11 daysfeat+test: custom-ordering: line manipulation utils + testsCraig Jennings
Introduce new functions cj/toggle-quotes, cj/reverse-lines, and cj/number-lines for line manipulation. cj/toggle-quotes swaps quotes within a region, cj/reverse-lines reverse the line order, and cj/number-lines adds line numbers with a customizable format, supporting zero-padding. Update keymap with new bindings. Add comprehensive tests for each function.
11 daysfeat+test:ordering: add prefix/suffix to arrayify/convenience funcsCraig Jennings
Enhanced cj/--arrayify with optional prefix/suffix parameters for flexible formatting: - prefix: string to prepend (e.g., "[" or "(") - suffix: string to append (e.g., "]" or ")") Added convenience functions: - cj/listify: unquoted list (a, b, c) - cj/arrayify-json: JSON array ["a", "b", "c"] - cj/arrayify-python: Python list ["a", "b", "c"] Updated keybindings: - C-; o l → cj/listify - C-; o j → cj/arrayify-json - C-; o p → cj/arrayify-python - C-; o L → cj/comma-separated-text-to-lines (moved from 'l')
11 days test+fix:custom-misc: add tests and fix fraction glyph bugCraig Jennings
Add test coverage for 4 functions in custom-misc.el: - cj/replace-fraction-glyphs (24 tests) - cj/format-region-or-buffer (17 tests) - cj/count-words-buffer-or-region (20 tests) - cj/jump-to-matching-paren (18 tests) Refactored functions using internal/interactive split pattern: - Internal functions (cj/--function-name) contain business logic with explicit parameters and validation - Interactive wrappers handle UI concerns (region detection, messages) - Tests call internal functions directly (no mocking required) Bug Fix: cj/--replace-fraction-glyphs Fixed "Invalid search bound" error when converting glyphs to text. Original code used fixed end position which became invalid when replacements changed buffer size. Fixed by using copy-marker for dynamic end position tracking.
11 days test+feat:custom-whitespace: add 37 tests + 2 new functionsCraig Jennings
Refactor all 4 existing whitespace functions to use interactive/non-interactive pattern and add comprehensive testing (73 tests). Implement 2 new functions: delete-all-whitespace (removes all whitespace) and ensure-single-blank-line (collapses consecutive blanks to one). Add keybindings for untabify/tabify. Total: 110 tests, 100% pass rate, 0 linter warnings.
11 daysbetter commentary for testsCraig Jennings
11 daystest:removing old (now redundant) testsCraig Jennings
11 days test+refactor:custom-whitespace: add comprehensive testing with 73 testsCraig Jennings
Refactor 4 whitespace manipulation functions (remove-leading-trailing, collapse-whitespace, delete-blank-lines, hyphenate-whitespace) to use interactive/non-interactive pattern for testability. Add 73 tests across 4 test files covering normal, boundary, and error cases. Fix linter warnings and add proper input validation.
11 dayschore: remove old redundant tests.Craig Jennings
11 daysfeat+test:comments: add 7 comment generation functions and testsCraig Jennings
Implement 5 new comment styles (simple-divider, padded-divider, heavy-box, unicode-box, block-banner) and refactor 2 existing functions (inline-border, comment-box) to use interactive/non-interactive pattern for testability. Add 178 tests across 7 test files with validation for length constraints and cross-language support. Fix linter warnings for parameter shadowing and docstring formatting.
11 daystest+fix:comments: add tests for cj/comment-reformat; fix arg issueCraig Jennings
Add 14 unit tests for cj/comment-reformat covering: - Emacs Lisp (12 tests): multiline joining, fill-column restoration, unicode, indentation, empty regions, read-only buffers - Python (1 test): hash-based comments - C (1 test): C-style comments (converted to block style by c-mode Fix issue where cj/comment-reformat was being called with args
11 daystest+docs:custom-comments: add tests for cj/delete-buffer-commentsCraig Jennings
Add 20 unit tests for cj/delete-buffer-comments covering: - Emacs Lisp (14 tests): comprehensive coverage of normal/boundary/error cases - Python (3 tests): hash-based comments (#) - C (3 tests): C-style line (//) and block (/* */) comments
11 days test+fix:custom-file-buffer: add tests, fix linter warningCraig Jennings
Add 58 unit tests for buffer/file utility functions: - cj/copy-link-to-buffer-file (12 tests) - cj/copy-path-to-buffer-file-as-kill (12 tests) - cj/copy-whole-buffer (14 tests) - cj/clear-to-bottom-of-buffer (10 tests) - cj/clear-to-top-of-buffer (10 tests) Tests cover normal cases, boundary cases (unicode, empty buffers, narrowing, read-only buffers), and error cases. Production code change: - Fix linter warning: unused variable 'err' → '_' in cj/move-buffer-and-file
11 days test:custom-file-buffer: add tests for cj/delete-buffer-and-fileCraig Jennings
Add 36 unit tests for cj/delete-buffer-and-file covering: - Normal cases: VC vs non-VC file deletion, trash flag usage - Boundary cases: file content variations, naming edge cases, buffer states - Error cases: permission issues, VC failures, error propagation Key testing decisions documented in Commentary: - Mock delete-file errors for deterministic, portable tests - Test our code's behavior (branching logic, error propagation), not the underlying trash/filesystem implementations - Verify correct calls to vc-delete-file vs delete-file with trash flag All 36 tests passing.
11 daysfeat+test:custom-file-buffer: add tests and safety refactoringCraig Jennings
Add 106 unit tests with full coverage for move-buffer-and-file (51 tests) and rename-buffer-and-file (55 tests). Refactor both functions using interactive/non-interactive split pattern for simpler testing and reusability. Changes: - Split cj/move-buffer-and-file and cj/rename-buffer-and-file into internal implementations (cj/--*) and interactive wrappers - Add ok-if-exists parameter with user confirmation to prevent data loss - Fix bugs: return values, path expansion, string-match arg order, regex - Add test utilities for proper buffer cleanup and isolation - Document interactive/non-interactive pattern in quality-engineer.org - Document error message testing guidelines in quality-engineer.org All 106 tests passing.
12 daystest:custom-line-paragraph: add tests for underscore-lineCraig Jennings
- Add 26 tests covering normal cases, boundary cases, and error cases - Tests verify column width calculation with tabs, Unicode support, various underline characters - Mock read-char function for batch mode testing - All 26 tests passing on first run
12 daysfix+test:custom-line-paragraph:infinite loop remove-lines-containingCraig Jennings
- Add guard clause to handle empty string input gracefully (would cause infinite loop) - Add 33 comprehensive tests covering normal cases, boundary cases, and error cases - Tests verify Unicode support, regex character escaping, region vs buffer operations - All 33 tests passing
12 daystest:custom-line-paragraph: remove-duplicate-lines-region-or-bufferCraig Jennings
- Add 35 tests covering normal cases, boundary cases, and error cases - Tests verify duplicate removal with case-insensitive matching, region vs buffer operations, Unicode support - Discovered function requires trailing newlines for duplicate detection and uses case-insensitive matching - All 35 tests passing
12 days test:custom-line-paragraph: tests for duplicate-line-or-regionCraig Jennings
- Add 31 tests covering normal cases, boundary cases, and error cases - Tests verify duplication with/without comments, Unicode, RTL text, undo behavior, and edge cases - All 31 tests passing
12 daystest:custom-line-paragraph: add tests and fix region deactivationCraig Jennings
- Add 11 new tests for cj/join-line-or-region covering boundary cases, Unicode, stress testing, and undo behavior - Fix region deactivation in cj/join-line-or-region function - All 62 tests now passing (41 join-line-or-region + 21 join-paragraph)
12 daysfix:org-roam: copy completed tasks to dailies on state transitionsCraig Jennings
Fixed and enhanced the org-roam hook that copies completed tasks to daily notes: - Fixed hook not triggering immediately after Emacs launch by moving it outside the lazy-loaded use-package org-roam :config block and into with-eval-after-load 'org - Changed hook to trigger for ANY org-done-keyword (DONE, CANCELLED, etc.) instead of just "DONE" - Updated hook to only trigger on non-done → done transitions using org-last-state, preventing duplicate copies when changing between done states (e.g., DONE → CANCELLED) - Added docstrings to org-roam helper functions to fix checkdoc linter warnings - Created comprehensive ERT test suite with 10 tests covering: * Hook registration before org-roam loads (lazy-loading fix) * Transitions to done states (nil→DONE, TODO→DONE, IN-PROGRESS→DONE, WAITING→CANCELLED) * Non-triggering cases (done→done, transitions to non-done states)
2025-10-22test: Add unit tests for `join-line-or-region` and `join-paragraph`Craig Jennings
Add comprehensive test cases for the `cj/join-line-or-region` and `cj/join-paragraph` functions within the custom-line-paragraph module. These tests cover normal, boundary, and error cases to ensure the proper functionality of line and paragraph joining features. They address various scenarios including line breaks, whitespace, Unicode content, and cursor positioning, enhancing the robustness of existing functionality.
2025-10-22feat: undead-buffers: Add `cj/make-buffer-undead` function and testsCraig Jennings
Introduce a new function `cj/make-buffer-undead` that appends a buffer name to the `cj/undead-buffer-list`, preventing it from being killed. This comes along with a suite of tests to check various scenarios and edge cases for handling undead buffers. Additionally, add tests for related functions: `cj/kill-buffer-or-bury-alive`, `cj/kill-buffer-and-window`, and others to ensure they correctly manage buffers, particularly with undead-status considerations. Refactor `undead-buffer-list` naming for consistency and clarity in the module.
2025-10-20test: dwim-shell-security: Add ERT tests for securityCraig Jennings
Introduce ERT tests for security-related functions within dwim-shell-config. These tests encompass normal, boundary, and error conditions to ensure: - Passwords aren't exposed in command outputs - Temporary files have restricted permissions (mode 600) - Proper cleanup of temporary files post-operation - Handling of edge cases and errors effectively
2025-10-20chore: testutil-general: update base directory path and commentsCraig Jennings
- Change base directory path from ~/.temp-gptel-tests/ to ~/.temp-emacs-tests/. - Modify accompanying docstrings and comments to reflect this update.
2025-10-20test: adding tests for compilation, keyboard macros, undead buffersCraig Jennings
2025-10-12changing repositoriesCraig Jennings