Skip to content

test(composer): add PrintLn unit tests#122

Draft
adcondev wants to merge 3 commits intomasterfrom
test-composer-println-1340867919024926419
Draft

test(composer): add PrintLn unit tests#122
adcondev wants to merge 3 commits intomasterfrom
test-composer-println-1340867919024926419

Conversation

@adcondev
Copy link
Owner

🎯 What:
Added a new test file pkg/composer/escpos_composer_test.go to test the PrintLn utility function.
This function was previously untested.
A mock mockPrintCapability was created to isolate the test from the actual printer command implementation.

📊 Coverage:

  • Added test for successful PrintLn execution (concatenation of Text and LineFeed).
  • Added test for error handling when Text command fails.

Result:
Improved test coverage for the composer package and ensured PrintLn behaves as expected.


PR created automatically by Jules for task 1340867919024926419 started by @adcondev

Added unit tests for the `PrintLn` function in `pkg/composer/escpos_composer.go`.
Implemented a `mockPrintCapability` to test the `PrintLn` function in isolation.
Covered both success and error scenarios.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions
Copy link
Contributor

👋 Thanks for opening this PR, @adcondev!

Here's what will happen next:

  • 🤖 Automated checks will run
  • 🏷️ Labels will be added automatically
  • 👀 A maintainer will review your changes

Please make sure:

  • ✅ All tests pass
  • 📝 The PR title follows conventional commits
  • 📋 The PR template is filled out completely

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

⚡ Benchmark Results

📈 Performance Comparison

📊 Click to expand detailed results

Current Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3117 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3624002	       332.9 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  375037	      2911 ns/op	    1809 B/op	      25 allocs/op
BenchmarkToJSON-4         	  515658	      2150 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  508786	      2338 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   92289	     12815 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  421780	      2817 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  273116	      4225 ns/op	     944 B/op	      21 allocs/op
BenchmarkTextCommandParsing-4       	  513444	      2165 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  240529	      4824 ns/op	    1000 B/op	      29 allocs/op
BenchmarkParseHexString-4           	 7577304	       157.8 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 6395600	       195.5 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	295085038	         4.056 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	33707640	        35.82 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14499152	        83.18 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  499314	      2428 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  136674	      8664 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     578	   2043056 ns/op	 3469945 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     310	   4041344 ns/op	 5481085 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     139	   8811963 ns/op	 5231178 B/op	  230423 allocs/op

Base Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3121 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3641552	       332.1 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  414970	      2919 ns/op	    1809 B/op	      25 allocs/op
BenchmarkToJSON-4         	  534522	      2119 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  492106	      2334 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   93241	     12843 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  414968	      2729 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  269995	      4206 ns/op	     944 B/op	      21 allocs/op
BenchmarkTextCommandParsing-4       	  532665	      2147 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  242180	      4810 ns/op	    1000 B/op	      29 allocs/op
BenchmarkParseHexString-4           	 7516606	       160.5 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 6452946	       187.0 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	295385060	         4.054 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	32113227	        36.71 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14496307	        83.01 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  499636	      2422 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  138657	      8613 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     576	   2073029 ns/op	 3469936 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     314	   3996583 ns/op	 5481085 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     136	   8703757 ns/op	 5231180 B/op	  230423 allocs/op

💡 Note: Use benchstat for statistical comparison

🎯 Summary

  • Total Benchmarks: 32
  • Average Speed: 2743544 ns/op
  • Average Memory: 2396764 B/op
  • Average Allocations: 41077 allocs/op

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant