Skip to content

test(cmd/gf): add unit tests for pack command#4642

Merged
gqcn merged 1 commit intogogf:masterfrom
lingcoder:test/pack-unit-tests
Jan 21, 2026
Merged

test(cmd/gf): add unit tests for pack command#4642
gqcn merged 1 commit intogogf:masterfrom
lingcoder:test/pack-unit-tests

Conversation

@lingcoder
Copy link
Contributor

Summary

  • Add comprehensive unit tests for the pack command which handles resource file packing
  • 8 new test cases covering core functionality

Test Coverage

Test Description
Test_Pack_ToGoFile Pack files to .go file
Test_Pack_ToBinaryFile Pack files to binary file
Test_Pack_MultipleSources Pack multiple source directories
Test_Pack_WithPrefix Pack with prefix option
Test_Pack_WithKeepPath Pack with keepPath option
Test_Pack_AutoPackageName Auto-detect package name from directory
Test_Pack_EmptySource Handle empty source directory
Test_Pack_NestedDirectories Handle deeply nested directory structure

Test plan

  • All 8 tests pass locally
  • No modifications to existing code
  • New test file only: cmd_z_unit_pack_test.go

Add comprehensive unit tests for the pack command which handles
resource file packing. The tests cover:

- Pack to Go file with package name
- Pack to binary file
- Pack multiple source directories
- Pack with prefix option
- Pack with keepPath option
- Auto package name detection
- Empty source directory handling
- Nested directory structure handling

8 new test cases added.
@gqcn gqcn merged commit bf2997e into gogf:master Jan 21, 2026
18 checks passed
@lingcoder lingcoder deleted the test/pack-unit-tests branch February 28, 2026 00:33
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.

2 participants