Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Test Inventory - Classification and Overview of All Tests

Created Date: 2025-11-06 Total Number of Tests: 153 Coverage: 68.95% (533/773 lines)


Test Classification

Test Pyramid Structure

Test TypeCountLocation
Unit Tests120src/ within #[cfg(test)]
Integration Tests33tests/ directory
E2E Tests26 casesdocs/tests/ (Manual)
Total153-

1. Unit Tests (120)

1.1 cache/types.rs (11)

Location: src/cache/types.rs within #[cfg(test)] module

Purpose: Data structure serialization/deserialization, type conversion

Test NamePurposeImportance
test_gist_cache_serializationGistCache JSON conversion⭐⭐⭐
test_datetime_serializationDatetime serialization (without sub-seconds)⭐⭐⭐
test_datetime_deserializationDatetime deserialization⭐⭐⭐
test_gist_info_without_descriptionHandling Gist without description⭐⭐
test_github_gist_to_gist_infoGitHub API → Internal type conversion⭐⭐⭐
test_gist_file_cloneGistFile clone
test_cache_metadataMetadata structure⭐⭐
OthersBasic type operations

Coverage: 100% (15/15 lines)

Windows Support: ✅ Fully supported (no file I/O dependencies)


1.2 config.rs (5)

Location: src/config.rs within #[cfg(test)] module

Purpose: Configuration management, platform-specific path generation

Test NamePurposeImportance
test_config_newConfig initialization⭐⭐⭐
test_config_defaultDefault settings⭐⭐⭐
test_ensure_cache_dirCache directory creation⭐⭐⭐
test_ensure_download_dirDownload directory creation⭐⭐
test_cache_existsCache file existence check⭐⭐

Coverage: 96.15% (25/26 lines)

Windows Support: ✅ Fully supported (tests platform-specific path generation)


1.3 cache/content.rs (18)

Location: src/cache/content.rs within #[cfg(test)] module

Purpose: Content cache read/write, directory management

Test NamePurposeImportance
test_write_and_readBasic read/write⭐⭐⭐
test_read_nonexistent_fileError handling for non-existent files⭐⭐⭐
test_write_creates_gist_directoryAutomatic directory creation⭐⭐⭐
test_overwrite_existing_fileOverwriting existing file⭐⭐
test_multiple_files_in_same_gistMultiple file management⭐⭐⭐
test_delete_gistDeleting Gist cache⭐⭐
test_delete_gist_already_deletedHandling already deleted Gist
test_list_cached_gistsListing cached Gists⭐⭐
test_list_cached_gists_when_no_cache_dirHandling no cache directory⭐⭐
test_list_cached_gists_with_file_in_contents_dirHandling unexpected files⭐⭐
test_total_sizeCalculating cache size⭐⭐
test_total_size_when_no_cache_dirSize when no directory
test_clear_allClearing all caches⭐⭐
test_clear_all_when_emptyClearing empty directory
test_cache_path_generationPath generation accuracy⭐⭐
test_self_healing_unexpected_filesSelf-healing of anomalous files⭐⭐
2 OthersEdge cases

Coverage: 83.54% (66/79 lines)

Windows Support: ✅ Fully supported (cross-platform with tempfile)


1.4 cli.rs (21)

Location: src/cli.rs within #[cfg(test)] module

Purpose: CLI argument parsing, interpreter analysis, cache commands

Test NamePurposeImportance
test_parse_interpreter_bashBash interpreter parsing⭐⭐⭐
test_parse_interpreter_pythonPython interpreter parsing⭐⭐⭐
test_parse_interpreter_nodeNode interpreter parsing⭐⭐
test_parse_interpreter_rubyRuby interpreter parsing⭐⭐
test_parse_interpreter_phpPHP interpreter parsing⭐⭐
test_parse_interpreter_perlPerl interpreter parsing⭐⭐
test_parse_interpreter_pwshPowerShell Core interpreter parsing⭐⭐
test_parse_interpreter_powershellWindows PowerShell interpreter parsing⭐⭐
test_parse_interpreter_ts_nodets-node interpreter parsing⭐⭐
test_parse_interpreter_denoDeno interpreter parsing⭐⭐
test_parse_interpreter_bunBun interpreter parsing⭐⭐
test_parse_interpreter_uvuv interpreter parsing⭐⭐
test_parse_interpreter_poetryPoetry interpreter parsing⭐⭐
test_parse_interpreter_shsh interpreter parsing⭐⭐
test_parse_interpreter_zshzsh interpreter parsing⭐⭐
test_parse_interpreter_python_aliaspython3 alias⭐⭐
test_parse_interpreter_noneNo interpreter⭐⭐
test_parse_interpreter_custom_invalidInvalid custom interpreter⭐⭐⭐
test_format_bytesByte formatting⭐⭐
test_format_bytes_edge_casesByte boundary values⭐⭐
test_format_bytes_multiple_gbGB unit display
test_handle_cache_command_list_emptyEmpty cache list⭐⭐
test_handle_cache_command_list_with_cacheCache list display⭐⭐⭐
test_handle_cache_command_list_no_metadataList without metadata⭐⭐
test_handle_cache_command_sizeCache size display⭐⭐
test_handle_cache_command_cleanCache clean (unimplemented)
test_run_gist_cache_not_foundCache not found error⭐⭐⭐
test_run_gist_no_resultsNo search results error⭐⭐⭐
test_run_gist_with_filename_searchFilename search mode⭐⭐⭐
test_run_gist_with_description_searchDescription search mode⭐⭐⭐
test_print_run_helpHelp display

Coverage: 78.16% (161/206 lines)

Windows Support: ✅ Fully supported


1.5 search/query.rs (26)

Location: src/search/query.rs within #[cfg(test)] module

Purpose: Search functionality, ID/filename/description search

Test NamePurposeImportance
test_search_by_idID search⭐⭐⭐
test_search_id_no_matchID search no match⭐⭐
test_search_by_filenameFilename search⭐⭐⭐
test_search_by_filename_case_insensitiveCase-insensitive filename search⭐⭐⭐
test_search_filename_multiple_filesMultiple file Gist search⭐⭐⭐
test_search_by_descriptionDescription search⭐⭐⭐
test_search_by_description_case_insensitiveCase-insensitive description search⭐⭐⭐
test_search_by_description_no_descriptionGist without description⭐⭐
test_search_bothFilename + description search⭐⭐⭐
test_search_both_filename_only_matchFilename only match⭐⭐
test_search_both_description_only_matchDescription only match⭐⭐
test_search_both_multiple_matchesMultiple matches⭐⭐
test_search_both_no_descriptionBoth search when no description⭐⭐
test_search_mode_auto_detects_idAuto: ID detection⭐⭐⭐
test_search_mode_auto_detects_bothAuto: Keyword detection⭐⭐⭐
test_search_mode_auto_with_short_hexAuto: 31-char hex⭐⭐⭐
test_search_mode_auto_with_non_hexAuto: Non-hexadecimal⭐⭐⭐
test_search_with_auto_mode_idAuto mode: ID⭐⭐
test_search_with_auto_mode_keywordAuto mode: Keyword⭐⭐
test_search_no_resultsNo search results⭐⭐⭐
test_search_empty_gist_listEmpty Gist list⭐⭐
test_select_from_single_resultSelection of single result⭐⭐
test_select_from_empty_resultsSelection from empty results⭐⭐
3 OthersEdge cases

Coverage: 70.59% (48/68 lines)

Windows Support: ✅ Fully supported


1.6 cache/update.rs (16)

Location: src/cache/update.rs within #[cfg(test)] module

Purpose: Cache update logic, differential update, MockGitHubClient

Test NamePurposeImportance
test_updater_newCacheUpdater initialization⭐⭐
test_save_and_load_cacheCache save/load⭐⭐⭐
test_load_cache_missing_fileHandling missing file⭐⭐⭐
test_save_cache_invalid_jsonDetecting invalid JSON⭐⭐
test_update_force_with_mockForce update (Mock)⭐⭐⭐
test_update_differential_with_mockDifferential update (Mock)⭐⭐⭐
test_update_with_no_changesHandling no updates⭐⭐
test_update_with_rate_limit_warningRate limit warning⭐⭐⭐
test_update_auth_failureAuthentication failure error⭐⭐⭐
test_update_with_gist_modification_deletes_cacheCache deletion upon Gist modification⭐⭐⭐
test_cache_updater_with_verboseVerbose mode⭐⭐
test_update_verbose_modeVerbose detailed logs⭐⭐
test_update_differential_with_existing_cache_verboseVerbose differential update⭐⭐
test_update_with_low_rate_limit_verboseVerbose low rate limit⭐⭐
test_update_gist_modification_verboseVerbose Gist update⭐⭐
test_update_force_verbose_without_existing_cacheVerbose new cache⭐⭐

Coverage: 62.24% (89/143 lines)

Windows Support: ✅ Fully supported


1.7 execution/runner.rs (10)

Location: src/execution/runner.rs within #[cfg(test)] module

Purpose: Basic functionality of ScriptRunner (file selection, option settings)

Test NamePurposeImportance
test_runner_newScriptRunner initialization⭐⭐
test_run_optionsRunOptions settings⭐⭐
test_run_options_combinationsOption combinations⭐⭐
test_run_options_preview_modePreview mode⭐⭐
test_run_options_download_modeDownload mode⭐⭐
test_select_main_file_single_fileSingle file selection⭐⭐⭐
test_select_main_file_multiple_filesMultiple file selection⭐⭐⭐
test_select_main_file_by_interpreterInterpreter-specific selection⭐⭐⭐
test_select_main_file_with_explicit_filenameExplicit filename specification⭐⭐⭐
test_runner_with_different_interpretersBehavior of each interpreter⭐⭐
test_display_infoInformation display

Coverage: 19.88% → 69.01% (improved by integration tests)

Windows Support: ✅ Fully supported (excluding execution part)


1.8 github/api.rs (1)

Location: src/github/api.rs within #[cfg(test)] module

Purpose: Initialization of GitHubApi struct (execution tests are #[ignore])

Test NamePurposeImportance
test_api_structureBasic structure functionality
test_check_auth_when_authenticated (#[ignore])gh authentication check⭐⭐⭐
test_get_user (#[ignore])Get username⭐⭐
test_check_rate_limit (#[ignore])Rate limit check⭐⭐
test_fetch_gists_without_since (#[ignore])Get all Gists⭐⭐⭐
test_fetch_gists_with_since (#[ignore])Get differential Gists⭐⭐⭐

Coverage: 8.33% (5/60 lines)

Windows Support: ⚠️ Partial support (requires gh CLI)


1.9 github/client.rs (5)

Location: src/github/client.rs within #[cfg(test)] module

Purpose: MockGitHubClient operation verification

Test NamePurposeImportance
test_mock_check_auth_successMock authentication success⭐⭐
test_mock_get_userMock user retrieval⭐⭐
test_mock_check_rate_limitMock rate limit⭐⭐
test_mock_fetch_gistsMock Gist retrieval⭐⭐
test_mock_fetch_gist_contentMock content retrieval⭐⭐

Coverage: 100% (MockGitHubClient implementation)

Windows Support: ✅ Fully supported


1.10 error.rs (4)

Location: src/error.rs within #[cfg(test)] module

Purpose: Error type conversion, display

Test NamePurposeImportance
test_error_displayError display⭐⭐
test_error_from_ioIO error conversion⭐⭐
test_error_from_jsonJSON error conversion⭐⭐
test_error_from_reqwestHTTP error conversion
test_result_type_aliasResult type alias

Coverage: 0% (Error types tested at runtime)

Windows Support: ✅ Fully supported


2. Integration Tests (12)

2.1 tests/integration_test.rs (6)

Location: tests/integration_test.rs

Purpose: Verification of actual interpreter execution

Dependencies: bash, python3, node (Unix environment recommended)

Test NamePurposefixtureImportance
test_execute_bash_scriptBash executionhello.sh⭐⭐⭐
test_execute_python_scriptPython executionhello.py⭐⭐⭐
test_execute_node_scriptNode.js executionhello.js⭐⭐
test_execute_with_argumentsArgument passingargs_echo.sh⭐⭐⭐
test_execute_failing_scriptError detectionerror_exit.sh⭐⭐⭐
test_preview_mode_does_not_executePreview modehello.sh⭐⭐⭐

Contribution to Coverage: execution/runner.rs +30-40%

Windows Support: ⚠️ Conditional

  • bash: Requires Git Bash or WSL
  • python3: Requires Windows Python
  • node: Requires Windows Node.js

2.2 tests/runner_test.rs (6)

Location: tests/runner_test.rs

Purpose: Detailed verification of ScriptRunner operations

Dependencies: bash (Unix environment recommended)

Test NamePurposefixtureImportance
test_download_mode_creates_fileDownload featurehello.sh⭐⭐⭐
test_preview_with_download_modePreview + Downloadhello.sh⭐⭐
test_cache_creation_after_executionCache creationhello.sh⭐⭐⭐
test_multiple_files_gistMultiple file selectionhello.sh⭐⭐⭐
test_force_file_based_executionFile-based executionhello.sh⭐⭐
test_script_with_empty_argumentsEmpty argument handlinghello.sh⭐⭐

Contribution to Coverage: execution/runner.rs +10-15%

Windows Support: ⚠️ Conditional (requires bash)

| args_echo.sh | Argument passing test | echo "Arguments: $@" | | error_exit.sh | Error test | exit 1 |

Windows Support: ⚠️ Newline code attention (LF recommended)


3. E2E Tests (26 Cases, Manual)

3.1 E2E Test Overview

What is E2E Testing?: Verification of complete user workflow by actually executing the binary from the command line

Reason for Not Implemented Yet: Lower priority than integration tests

Planned Implementation:

tests/e2e/
├── test_full_workflow.sh        # Complete flow of update → run
├── test_cache_management.sh     # cache list/size/clear
└── test_option_combinations.sh  # --force, --preview, --download

Expected Benefits:

  • Full assurance of user experience
  • Integration verification between modules
  • Automation of manual tests

Test Classification Summary

ClassificationNumber of TestsCoverage ContributionWindows SupportStatus
Unit Tests12057-60%✅ Full✅ Completed
Integration Tests12+10-11%⚠️ Conditional✅ Completed
E2E Tests26 cases+2-3%⚠️ Conditional📝 Completed
Total13268.18%--

Test Importance Criteria

MarkMeaningDescription
⭐⭐⭐EssentialDirectly leads to data loss or critical bugs
⭐⭐RecommendedAffects user experience or major features
OptionalEdge cases or rare situations

Coverage Contribution

High Contribution (10% or more)

  • Integration Tests (tests/integration_test.rs + runner_test.rs): +10.87%
    • Covers execution part of execution/runner.rs

Medium Contribution (5-10%)

  • cli.rs Unit Tests: Contributes approx. 5-6% to overall
  • search/query.rs Unit Tests: Contributes approx. 4-5% to overall

Low Contribution (1-5%)

  • Individual unit tests for each module

Test Implementation History

Phase 1-5 (Unit Tests): 120

  • cache/types.rs: 11
  • config.rs: 5
  • cache/content.rs: 18
  • cli.rs: 21
  • search/query.rs: 26
  • cache/update.rs: 16
  • execution/runner.rs: 10
  • github/client.rs: 5
  • error.rs: 4
  • Others: 4

Achieved Coverage: 57.31%

Phase 6 (Integration Tests): 12

  • tests/integration_test.rs: 6
  • tests/runner_test.rs: 6
  • tests/fixtures/: 5 files

Achieved Coverage: 68.18% (+10.87%)

Phase 7 (E2E): 26 Cases (Manual Execution)

Expected Coverage: 70-71% (+2-3%)


Last Updated: 2025-11-06 Coverage: 68.95% (533/773 lines)