Skip to content

Add Unit tests for UX and Engine packages - #58

Merged
tonymeehan merged 5 commits into
prequel-dev:mainfrom
kris-gaudel:main
Jun 16, 2025
Merged

tonymeehan merged 5 commits into
prequel-dev:mainfrom
kris-gaudel:main

Conversation

@kris-gaudel

Copy link
Copy Markdown
Contributor

Added comprehensive unit tests for UX and Engine packages to improve test coverage and reliability.

Changes:

  1. UX Package:
  • Added tests for PrintVersion, PrintUsage, NewProgressWriter
  • Added tests for all tracker constructors (NewRuleTracker, NewProblemsTracker, etc.)
  • Added tests for error helpers and output functions
  • Added tests for utility functions like ProcessName, WriteDataSourceTemplate
  • Coverage increased from 8.0% to 32.0%
  1. Engine Package:
  • Fixed panic in StartLinesTracker by properly initializing UxEval instances
  • Added tests for New, AddRules, GetCre, Close, and Run functions
  • Added test cases for edge cases and error conditions
  • Coverage increased to 10.9%

Overall test coverage increased from 45.2% to 49.43%

@kris-gaudel

Copy link
Copy Markdown
Contributor Author

@tonymeehan Please lmk if you have feedback 👍🏼

Comment thread internal/pkg/ux/ux_util_test.go Outdated
}

// Helper function to check if a string contains a substring
func contains(s, substr string) bool {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is doing what we want. This would return true for s=AAAA and substr="B"

https://go.dev/play/p/iuYrKInn5BW

Should use strings.Contains(str, substr).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, idk how I missed this 😅

@kris-gaudel
kris-gaudel requested a review from tonymeehan June 13, 2025 14:55
@tonymeehan
tonymeehan merged commit bf850ab into prequel-dev:main Jun 16, 2025
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