Class: BashCommentFormatterTest
- Defined in:
- lib/hash_delegator.rb
Instance Method Summary collapse
-
#test_format_empty_string ⇒ Object
Test formatting an empty string.
-
#test_format_multi_line_string ⇒ Object
Test formatting a multi-line string.
-
#test_format_simple_string ⇒ Object
Test formatting a normal string without special characters.
-
#test_format_string_with_hash ⇒ Object
Test formatting a string containing hash characters.
-
#test_format_whitespace ⇒ Object
Test formatting strings with leading and trailing whitespace.
Instance Method Details
#test_format_empty_string ⇒ Object
Test formatting an empty string
2478 2479 2480 2481 2482 |
# File 'lib/hash_delegator.rb', line 2478 def test_format_empty_string input = '' expected = '# ' assert_equal expected, BashCommentFormatter.format_comment(input) end |
#test_format_multi_line_string ⇒ Object
Test formatting a multi-line string
2485 2486 2487 2488 2489 |
# File 'lib/hash_delegator.rb', line 2485 def test_format_multi_line_string input = "This is the first line.\nThis is the second line." expected = "# This is the first line.\n# This is the second line." assert_equal expected, BashCommentFormatter.format_comment(input) end |
#test_format_simple_string ⇒ Object
Test formatting a normal string without special characters
2464 2465 2466 2467 2468 |
# File 'lib/hash_delegator.rb', line 2464 def test_format_simple_string input = 'This is a simple comment.' expected = '# This is a simple comment.' assert_equal expected, BashCommentFormatter.format_comment(input) end |
#test_format_string_with_hash ⇒ Object
Test formatting a string containing hash characters
2471 2472 2473 2474 2475 |
# File 'lib/hash_delegator.rb', line 2471 def test_format_string_with_hash input = 'This is a #comment with hash.' expected = '# This is a \\#comment with hash.' assert_equal expected, BashCommentFormatter.format_comment(input) end |
#test_format_whitespace ⇒ Object
Test formatting strings with leading and trailing whitespace
2492 2493 2494 2495 2496 |
# File 'lib/hash_delegator.rb', line 2492 def test_format_whitespace input = ' This has leading and trailing spaces ' expected = '# This has leading and trailing spaces ' assert_equal expected, BashCommentFormatter.format_comment(input) end |