From e48f32b50afd22bc4534fe85d38d2c3687ac6ba8 Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Mon, 3 Nov 2025 20:36:17 +0100 Subject: [PATCH] Engine: Add proper support for ERB trimming --- lib/herb/engine.rb | 6 +- lib/herb/engine/compiler.rb | 135 ++++++++++++++-- lib/herb/engine/debug_visitor.rb | 6 +- sig/herb/engine/compiler.rbs | 24 ++- sig/herb_c_extension.rbs | 2 +- test/engine/cli_test.rb | 6 +- test/engine/rails_compatibility_test.rb | 2 +- test/engine/whitespace_trimming_test.rb | 152 ++++++++++++++++++ test/engine_visitors_test.rb | 4 +- test/snapshot_utils.rb | 4 +- ...ifier_6a92e7d29b0b8ff99771a96e90f4ac10.txt | 66 -------- ...iline_ff404c4e708f59f532b4042441e458ad.txt | 11 +- ..._tags_95bcfa3f3e28634bf923f18df0cd38a1.txt | 7 +- ...after_0ee0ba8a9a25359175b884cf66f37b2c.txt | 13 +- ...iline_6bf3affa07b559b73f6428e0dbd270d2.txt | 1 - ..._tags_8a842d797202d0b31c9832cd43a22686.txt | 1 - ...after_c5e6a4e1e9e691af8dcc74ae6c9564c9.txt | 3 - ...g_tag_72379778fa34572e48b949a780f761b1.txt | 11 +- ...g_tag_e1b62f3b00e8efb6cac1e5842461de10.txt | 1 - ...fault_1ae6b8eb8b1931a65192bc14b7593e1c.txt | 3 +- ...abled_71a0c34d23cde4f85d84b577b3ac6e86.txt | 3 +- ...tions_831362fdf630e5facad634abab817ddd.txt | 3 +- ..._span_9431501e9722fe8b38c66468fd77c1f5.txt | 3 +- ...spans_78e7fde7b24d6ebbef7b0cc3e02dfeeb.txt | 3 +- ...spans_9827f669a2c87b0da29ee3e73f2485a8.txt | 3 +- ...spans_fa19152dbae94261cb892c6fe543ee74.txt | 3 +- ...spans_841ac66ea0f03edd85fe096706e27292.txt | 3 +- ...aries_48fc68664d9cabb3813ea9b86d3f8bbd.txt | 3 +- ...aries_15153b8ec3486c918ba9fcb33386aeee.txt | 3 +- ...child_683f80e816cdd50d5e065d1e91bcce53.txt | 3 +- ...rtial_00b34061b9686a4c930bd9ab0bd4665d.txt | 3 +- ...aries_a536d3d2225f6f8d1163956571c1623b.txt | 3 +- ...arkup_b88df3287cc07c730b007a0e6a3aace2.txt | 12 +- ...arkup_07372a921f413dd0d25e4fc4d599e417.txt | 3 +- ...spans_c71ab7a64204c499e9b116ffc3fbf03d.txt | 6 +- ...aries_a8600827a6adf41bc60a28a65a7ebe50.txt | 6 +- ...butes_a900dc734c9ad44f41ee0df5f88e0e68.txt | 3 +- ...calls_9ff80d616cac6cd6536d9d1c69828d42.txt | 3 +- ...abled_ed8d270f96c299d791e00fdbec8726b1.txt | 3 +- ...abled_d5b28d0c6e5cc66787fa0f0134fe2642.txt | 3 +- ...spans_00962cc49ea43b8d9e11e5b050b24a56.txt | 3 +- ...tures_8183ba9ca86a867463e5eef28dede268.txt | 15 +- ..._type_6441400221f6c4babe86ffc5da0cd758.txt | 3 +- ..._type_1d1f4277e9176d7fdfd12943bfdca2fe.txt | 3 +- ..._type_085c2022e3fc5db7ee51f4bdb45e58cc.txt | 3 +- ..._type_25a2a32341c4efbd5fc67fcaccc65e04.txt | 3 +- ..._type_d94d55997ab20001501c4d8811a7bb88.txt | 3 +- ..._type_93a0348e20c77450c6d171153f72e728.txt | 3 +- ..._type_0c837ffe84723a464e884d64d0e062dd.txt | 3 +- ...ments_89b5f8286cf91457e3403e9ac303a110.txt | 19 ++- ...t_tag_a96009c6e583d1020beeee97e1ce62a9.txt | 3 +- ...paces_be6b19dff594a892a386128f09ffe067.txt | 3 +- ...space_bac3b0b435460da6f79e9f55aa0330e8.txt | 3 +- ...w_div_949cda6115e11aa1c64a4ba7f14af8d7.txt | 3 +- ...w_div_a5de27451c9360545052120fb160f115.txt | 6 +- ...spans_8089875648934cfa3372da1612535899.txt | 3 +- ...spans_749dc54ef9bc43f01a7308eb5aceb38e.txt | 3 +- ...spans_310e2cf33eed6523c1327b9489be9c7c.txt | 3 +- ...spans_0e904ebb5414efb4cb37c5370cb965a2.txt | 3 +- ...spans_29f280295d96a879bf9775e4ca2509b8.txt | 3 +- ...spans_f7e26660aada5f63b9e67e4082fa3efe.txt | 3 +- ...calls_21cbfad3d0a53e094cf337404372e3cc.txt | 17 +- ...tests_8bcb5712e0fc1e7b6a6b8639a98f4e14.txt | 3 +- ...heses_f1ec47d1e1a09d1114d928c64d54de58.txt | 3 +- ...aping_7296abe3ce9cad7a56f653b0669c8e0a.txt | 3 +- ...heses_f5a50306423c1234d1f86bef4244b302.txt | 3 +- ...ction_767532fe886f09850d3e2117de637a56.txt | 3 +- ...ngine_7d6fcd9b42b7c23b832eae52e36033ef.txt | 3 +- ...ngine_a7a38b365e168de54928cd4b780619ce.txt | 3 +- ...butes_1a41c1fd03ace896cc730634012d9df9.txt | 3 +- ...aping_449cb47f122ffe05c8a3938b86db01da.txt | 3 +- ...aping_a367cd981eadfdc5c6a824c1bdf2694f.txt | 3 +- ...token_42d9dc7e0c0dd5ae36a7ddde7f11ef75.txt | 3 +- ...token_e81d630999b5fe77477e60ce788a1e3d.txt | 3 +- ...ectly_92d1893d3882087a626b1b7683e91762.txt | 8 +- ...ectly_903b2af211dfab8347850d71f6e431e8.txt | 17 +- ..._tags_9ae679bbe8b534b33f7f0482cab09601.txt | 3 +- ...sions_4746f6e488bfcd3ec68007d129631394.txt | 13 +- ..._text_c1db0d9f3d8889c22cba5f33cca0a81b.txt | 3 +- ...t_tag_271458511492ec7e18baf77d0b7a04c3.txt | 4 +- ...ments_9c479c9d1b4668c4a5e3ecf9dfdc7d04.txt | 3 +- ...ption_a7a38b365e168de54928cd4b780619ce.txt | 3 +- ...ption_f439b215d233f255a2d983be50a566a6.txt | 3 +- ...aping_031ede7b0d3f38a431bb4e2009e597d2.txt | 3 +- ...aping_7d6fcd9b42b7c23b832eae52e36033ef.txt | 3 +- ...ufvar_4b12581137e52226597b0aa84fec1148.txt | 3 +- ...ption_c7cfe845c307b290283374cda0e6b3bd.txt | 3 +- ...ption_848883dc35cf359944935b46efa0d2a1.txt | 3 +- ...ption_ae490373e053cdc4f8e3effa5267d81e.txt | 3 +- ...amble_3b55a12762518f8786870b322ca30296.txt | 3 +- ...ption_5087762b1aa5a6cb20238d3e8292b14f.txt | 3 +- ...efunc_b132833b75887924426e4f08e89a7a3b.txt | 3 +- ...ption_7c6e88add003e4e2d3e5321121035b4d.txt | 3 +- ...ption_d91d14c6c78ca542efb889aef824b39f.txt | 3 +- ...plate_8033045d7c8ec7030c37a69705c95b59.txt | 21 ++- ...ectly_ec8e16b071f1512af4c11c6f5e83a83e.txt | 3 +- ...tions_9b2c1232f3a08d85651530a3a053bd1d.txt | 3 +- ...tions_80bc91b8f61b130833a0db535587906f.txt | 3 +- ...ation_8787e8652af182a14b119c02e42d41ef.txt | 3 +- ...aping_97a4cf60e21a27282801c928e34cc7ad.txt | 3 +- ...aping_dab6b2186b82b0e6da5e7aba13328292.txt | 3 +- ...reeze_2c027491a18992cfc58f26e5e11d132e.txt | 3 +- ..._flow_e92996083eebcc06dbfdbe99b01405d4.txt | 12 +- ...loops_ce09605dc8d98fa00b772641bcb94756.txt | 8 +- ...butes_ae606d306ed113ca8c81bac949c95f0b.txt | 3 +- ...butes_d9215319e7a45e85562051ee88efb393.txt | 3 +- ...ufvar_648bc9c3988d6e3e11794740df367ac6.txt | 3 +- ...ments_3979e9f719fb6a669a5f8954def7c5cb.txt | 3 +- ...ments_710fe3f51d746ce1e228e58597aea388.txt | 3 +- ...ctype_92f22a69d9a42244fd6bcb2269a2da78.txt | 3 +- ...tures_80dc820543c2a2f82784e771830a3ce2.txt | 35 ++-- ...ement_7a2d40e72c76ae8704ea920276c8941e.txt | 3 +- ...ation_1437d0425640509570342c24b30de571.txt | 19 ++- ..._line_ece56a54ce9835acc67012583c42fc01.txt | 4 +- ...wline_32dd50121c8e2af22b8a7e5efd92940f.txt | 5 +- ..._code_987d6e126382f02311aa0c1a0e0007bc.txt | 4 +- ..._code_d6e28172fd69bf4538744950bffb2848.txt | 4 +- ...paces_a1f69e41bb63eacbc881533c704e17a4.txt | 4 +- ...iline_1dc1e842d2fb5a2484c2e2fa0eca3678.txt | 9 +- ...wline_3519273b500925a720622d82288e0a31.txt | 1 - ...paces_403e802d2a1c4f738b359fc3eee74053.txt | 2 +- ...iline_c4d3ea038c11a5575430ca4b14abff47.txt | 2 +- ...fault_82a7a92705ab6d35e9b98dcf832df658.txt | 3 +- ..._true_bbb2f1b4762867f152a22fb91e012a4c.txt | 3 +- ...rfunc_cf03e906f47d2afbb15fa203feeeb459.txt | 3 +- ...rfunc_d7d14e66fe9908f96175d0fc31e0dac1.txt | 3 +- ...rfunc_8f14421c2d93dcbfc8c32ebcd79e356c.txt | 3 +- ...rfunc_b5195ed0791ce8b7fb7e9957385d0888.txt | 3 +- ...rfunc_60c2561eccf31fcc7be74358531d361a.txt | 3 +- ...rfunc_d36d73b6689a9ee6b1dd7429bacb5577.txt | 3 +- ...fault_4fb2161faf855683340cde061df50b63.txt | 3 +- ..._true_44fdc28505aff5a94a37c9368fc76e9d.txt | 3 +- ...efunc_40f8668374512910499884ea2bd53300.txt | 3 +- ...efunc_9e92c0a389c10a598f8ced575449686c.txt | 3 +- ...efunc_3e35bb560dddb5f03f2d193e3e455d00.txt | 3 +- ...efunc_fd847a19c1f5170be7d9a8e865ff9fb3.txt | 3 +- ...efunc_7683083386c679d64322db896966279d.txt | 3 +- ...efunc_8588ecfab0b1fa69e732bbad0941ebf7.txt | 3 +- ...fault_f2be84eb0a72782680d35cf59765e9a8.txt | 3 +- ..._true_a71d7635b10408058ae5f6f8337d1e0c.txt | 3 +- ...efunc_d8d378cd430fd52648905d31467fd15f.txt | 3 +- ...efunc_6d8030e9f8e12e3a882ebc492e1efb1c.txt | 3 +- ...efunc_6549bbd875e087b9318ec6c35f61dd42.txt | 3 +- ...efunc_8d28173c3875daee25c08f28b41fa510.txt | 3 +- ...efunc_a0353f00c62b0daf50687e9c8d223391.txt | 3 +- ...efunc_f7d39b8a11a3022e2ef1a697e3c46888.txt | 3 +- ...fault_b2330479d7cdc3d3bd870cbda6e5a13a.txt | 3 +- ..._true_b20f9d8b8dcf7e533b68a6db0194bc75.txt | 3 +- ...sfunc_fff096d3faee3e5c8c1b1f5d09f407d1.txt | 3 +- ...sfunc_33b8e30f7bf28e4f9dfc23d89e187438.txt | 3 +- ...sfunc_efcb50766c5a8f17b97cfd5ad4ca67cd.txt | 3 +- ...sfunc_96ece398c40750f59650d0c35f953dd9.txt | 3 +- ...sfunc_f436b9a75e95db20869db3ea9fd57766.txt | 3 +- ...sfunc_3d49d1a8bb960fe85c74d4deb4d3107f.txt | 3 +- ...fault_b2440242cdba618522e76914ac63a054.txt | 3 +- ..._true_4781fa0cc6abdaa0769dba2eb345e4cd.txt | 3 +- ...sfunc_bbd4d2d294779b5762d02b2e1c07fb11.txt | 3 +- ...sfunc_986ecd0589393eb937ceee2aa419f49e.txt | 3 +- ...sfunc_cd5298d4aac80c862e718692bdf83eab.txt | 3 +- ...sfunc_4d1ec0837eb25b77cd79886db2c4dee6.txt | 3 +- ...sfunc_28db6ce107bc81f050f3de9a654f8fa5.txt | 3 +- ...sfunc_3cb7a8609a8656ee321b953d5a5132f4.txt | 3 +- ..._true_f476d94ad451540a483556ee84873425.txt | 2 - ...false_cc1fa20e0a32190d88a0227eb61a12a9.txt | 2 - ...ering_6e40ec8a557eaa730717359ad0e81955.txt | 4 - ...loops_41457e8139a808914d288744c4e0c532.txt | 9 -- ...sions_4a8e4604acd824ebd86dd77c316ced30.txt | 2 - ...false_c4f4ef6359c9b399bbe059b270d0388f.txt | 2 - ..._true_62ddfd676314329facbb84fd7db1974c.txt | 2 - ...nding_8fd46cbbe67a0d2871dee4eca5f8e38f.txt | 2 - ...roved_989341ea9ef14353decf0f2697a3b605.txt | 2 - ...known_8bdf6d6267e185f6eaaa261aed0851fd.txt | 2 - ...dling_8efdae73f991e421da3048f196d4f1e2.txt | 3 - ...ample_77e6fc93cd860e93537231583cd9cf3f.txt | 21 --- ...dling_1a606908d02705253fec4859259e69e2.txt | 1 - ...wline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt | 1 - ...paces_c05d8f81793b59bea0ce93cf959bcfbe.txt | 2 +- ...iline_d65c4c66f63611e90c0ea96b74af1ce4.txt | 2 +- ...ation_441036c464ee35f7b120090fe76d6936.txt | 3 +- ...ation_cf3fa644ffeb7b672053fa0e989f55b5.txt | 16 +- ...ation_40b3cb480f677f54d2ff8f47af37f7fa.txt | 13 +- ...ation_d5c98b9f230e001f8aabf838d3774698.txt | 9 +- ...ation_edc2f02149a3cdcced4e6d0830b5f251.txt | 17 +- ...ation_6f13b7233db413c987e289ad2b3e3a3a.txt | 13 +- ...ation_3ee70e5b90c1ff368a7783c49c6dc611.txt | 37 +++-- ...ation_da96aac1987dbb33d41eb4a121419b47.txt | 3 +- ...ation_2b3c4e3c244db77468813a7472298e82.txt | 3 +- ...ation_a33dd3e79d24b4f31f6d4e92611f3f63.txt | 3 +- ...ation_8c18fb8399a2fd1e65b0333bc01e041c.txt | 4 +- ...ation_0109f6af5a474973b8b1b52636135c4f.txt | 3 +- ...ation_eeecb969def01ab8005c7b9f23686fed.txt | 12 +- ...ation_1437d0425640509570342c24b30de571.txt | 19 ++- ...ation_ba78b92bec7a4692a2043f2ba2ebe057.txt | 3 +- ...ation_4ddb2a17755d3e775e3225970bc60a96.txt | 6 +- ...ation_aa8aed9ef61b138a28efed42f4b72251.txt | 41 +++-- ...ation_1729fad3a77618acdc687c9fb671b75b.txt | 16 +- ...ation_d81de4ca83482c4836215ef7177d9eec.txt | 4 +- ...ation_9c22f391d1d03fa66b3d18095354a236.txt | 3 +- ...ation_0b1269c00fd15a74df125278ed6a9fc4.txt | 14 +- ...ation_45fa7aa654c0dc06d1a1b9504002dfba.txt | 7 +- ...ation_a705eb5ed83b4db368d7204baa136b36.txt | 10 +- ...ation_527dd13a0a4ec520816dc6bb5f4c7279.txt | 4 +- ...lates_3412d8be45b5f990c1e1bff365ae57dc.txt | 7 +- ...adata_617be03c239297032907b0de8f4b03e9.txt | 3 +- ...ation_56b68d6a3512c749780d10fa0efcc762.txt | 3 +- ...ation_8ce219076424a268ded2740f54be7bc6.txt | 3 +- ...rrors_4546acae1ccf8092d2178e7ce803985e.txt | 3 +- ...rrors_b90f26866326dddf616dce19ccf8f8a1.txt | 3 +- ..._HTML_f0f5f57b1f0e9b7d0cd2bee98022629a.txt | 3 +- ...rrors_e6a7c767c8906df797e04d39ba8f3806.txt | 3 +- ..._mode_64ae994d3dab8108fd9268bdfd83cba3.txt | 3 +- ..._mode_d773b47c4c4366891bc6dd6e086cd138.txt | 3 +- ...space_5cadacd41cb757624bb397656a2e0e0c.txt | 5 + ...space_6d3c65e96f170fb180dc33f022754f9d.txt | 8 + ...wline_69c9cce35a6af46ef129b944865ca70d.txt | 5 + ...wline_e852e4dc988e2976e2bbb0cbb21d1110.txt | 8 + ..._trim_d2a8d86d185c415f319f67357dc5c3bf.txt | 8 + ..._trim_fdcdb38725bad90a7107b2ac7b5f6b6b.txt | 5 + ..._line_23e63662b4ba8bb3fb5a5a1bb1d53b9e.txt | 7 + ..._line_3f132e14d95ed78133b87aa8b677f4c1.txt | 10 ++ ..._line_5cecef16fbbafd80aca3bf498dfb7eb9.txt | 7 + ..._line_5d9825831d6ccd4e061c62f23b732294.txt | 10 ++ ...ntent_73459c2f2e974a49064d73399fbd8107.txt | 5 + ...ntent_ae222e3cdb952dbe88a5d78ec09342f0.txt | 6 + ...ntent_8401eeac9b536aeae6fa532142803f97.txt | 7 + ...ntent_c5218603adeca9a13e201776a9532cbb.txt | 5 + ..._tags_88d4447a380c5dc65d3a31af8ecc6e74.txt | 10 ++ ..._tags_d6a2a730e435a7db6b366e2cec6dde68.txt | 5 + ...sions_abe60f63454b03afbef901657f42700c.txt | 8 + ...sions_cb61528b7c29d6b9759c4bb24a5b00f4.txt | 5 + ...sions_2b40ffdf266e4620412e79af42e51d8d.txt | 5 + ...sions_eeb221058b1f7a71776015aec4024663.txt | 8 + ...sions_13d12d13490f9d28f776f55f8769f353.txt | 5 + ...sions_749dcc821200b4f2da6fb013630c8e35.txt | 8 + ...space_1a281b87a37b77e5deff6df89f2d5304.txt | 5 + ...space_b1bc5c5bbf88bbf4be1c1c1867ceb6d4.txt | 8 + ...locks_4ed5df5e19dec1c7f7bffa017bcf66f4.txt | 10 ++ ...locks_db89f8f079e064b205347df54a91fa8b.txt | 6 + ..._file_688979d30ffb1ebd7ad117f92729aa2c.txt | 5 + ..._file_6e29dbbfa0adbfe7385b8c39b04341cd.txt | 8 + ..._file_23af33bb01b7a4e2aee6fc4f2fe8c62d.txt | 5 + ..._file_a8c9c24a1f7dda4a5a9da5ccd5bd5941.txt | 8 + 242 files changed, 901 insertions(+), 722 deletions(-) create mode 100644 test/engine/whitespace_trimming_test.rb delete mode 100644 test/snapshots/analyze/if_test/test_0011_guard_clause_with_return_if_modifier_6a92e7d29b0b8ff99771a96e90f4ac10.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0001_left_trim_removes_preceding_whitespace_5cadacd41cb757624bb397656a2e0e0c.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0001_left_trim_removes_preceding_whitespace_6d3c65e96f170fb180dc33f022754f9d.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0002_right_trim_removes_following_newline_69c9cce35a6af46ef129b944865ca70d.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0002_right_trim_removes_following_newline_e852e4dc988e2976e2bbb0cbb21d1110.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0003_left_and_right_trim_d2a8d86d185c415f319f67357dc5c3bf.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0003_left_and_right_trim_fdcdb38725bad90a7107b2ac7b5f6b6b.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0004_left_trim_with_whitespace_on_previous_line_23e63662b4ba8bb3fb5a5a1bb1d53b9e.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0004_left_trim_with_whitespace_on_previous_line_3f132e14d95ed78133b87aa8b677f4c1.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0005_right_trim_with_whitespace_on_following_line_5cecef16fbbafd80aca3bf498dfb7eb9.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0005_right_trim_with_whitespace_on_following_line_5d9825831d6ccd4e061c62f23b732294.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0006_left_trim_does_not_affect_non-whitespace_content_73459c2f2e974a49064d73399fbd8107.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0006_left_trim_does_not_affect_non-whitespace_content_ae222e3cdb952dbe88a5d78ec09342f0.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0007_right_trim_does_not_affect_non-newline_content_8401eeac9b536aeae6fa532142803f97.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0007_right_trim_does_not_affect_non-newline_content_c5218603adeca9a13e201776a9532cbb.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0008_multiple_consecutive_trimmed_tags_88d4447a380c5dc65d3a31af8ecc6e74.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0008_multiple_consecutive_trimmed_tags_d6a2a730e435a7db6b366e2cec6dde68.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0009_left_trim_with_expressions_abe60f63454b03afbef901657f42700c.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0009_left_trim_with_expressions_cb61528b7c29d6b9759c4bb24a5b00f4.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0010_right_trim_with_expressions_2b40ffdf266e4620412e79af42e51d8d.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0010_right_trim_with_expressions_eeb221058b1f7a71776015aec4024663.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0011_left_and_right_trim_with_expressions_13d12d13490f9d28f776f55f8769f353.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0011_left_and_right_trim_with_expressions_749dcc821200b4f2da6fb013630c8e35.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0012_no_trim_preserves_whitespace_1a281b87a37b77e5deff6df89f2d5304.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0012_no_trim_preserves_whitespace_b1bc5c5bbf88bbf4be1c1c1867ceb6d4.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0013_trim_with_nested_blocks_4ed5df5e19dec1c7f7bffa017bcf66f4.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0013_trim_with_nested_blocks_db89f8f079e064b205347df54a91fa8b.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0014_left_trim_at_start_of_file_688979d30ffb1ebd7ad117f92729aa2c.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0014_left_trim_at_start_of_file_6e29dbbfa0adbfe7385b8c39b04341cd.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0015_right_trim_at_end_of_file_23af33bb01b7a4e2aee6fc4f2fe8c62d.txt create mode 100644 test/snapshots/engine/whitespace_trimming_test/test_0015_right_trim_at_end_of_file_a8c9c24a1f7dda4a5a9da5ccd5bd5941.txt diff --git a/lib/herb/engine.rb b/lib/herb/engine.rb index 3706eaa59..967fd82f8 100644 --- a/lib/herb/engine.rb +++ b/lib/herb/engine.rb @@ -87,11 +87,9 @@ def initialize(input, properties = {}) end @src << "__herb = ::Herb::Engine; " if @escape && @escapefunc == "__herb.h" - @src << preamble - @src << "\n" unless preamble.end_with?("\n") - parse_result = ::Herb.parse(input) + parse_result = ::Herb.parse(input, track_whitespace: true) ast = parse_result.value parser_errors = parse_result.errors @@ -190,6 +188,8 @@ def add_code(code) if code.include?("=begin") || code.include?("=end") @src << "\n" << code << "\n" else + @src.chomp! if @src.end_with?("\n") && code.start_with?(" ") && !code.end_with?("\n") + @src << " " << code # TODO: rework and check for Prism::InlineComment as soon as we expose the Prism Nodes in the Herb AST diff --git a/lib/herb/engine/compiler.rb b/lib/herb/engine/compiler.rb index e09731e7d..ce3d5a4a3 100644 --- a/lib/herb/engine/compiler.rb +++ b/lib/herb/engine/compiler.rb @@ -86,7 +86,7 @@ def visit_html_open_tag_node(node) end def visit_html_attribute_node(node) - add_text(" ") + add_whitespace(" ") visit(node.name) @@ -134,7 +134,7 @@ def visit_literal_node(node) end def visit_whitespace_node(node) - add_text(node.value.value) if node.value + add_whitespace(node.value.value) end def visit_html_comment_node(node) @@ -168,7 +168,7 @@ def visit_erb_content_node(node) end def visit_erb_control_node(node, &_block) - add_code(node.content.value.strip) + apply_trim(node, node.content.value.strip) yield if block_given? end @@ -325,17 +325,15 @@ def process_erb_tag(node, skip_comment_check: false) if erb_output?(opening) process_erb_output(opening, code) else - add_code(code) + apply_trim(node, code) end - - handle_whitespace_trimming(node) end def add_text(text) return if text.empty? if @trim_next_whitespace - text = text.lstrip + text = text.sub(/\A[ \t]*\r?\n/, "") @trim_next_whitespace = false end @@ -344,6 +342,10 @@ def add_text(text) @tokens << [:text, text, current_context] end + def add_whitespace(whitespace) + @tokens << [:whitespace, whitespace, current_context] + end + def add_code(code) @tokens << [:code, code, current_context] end @@ -359,11 +361,13 @@ def add_expression_escaped(code) def optimize_tokens(tokens) return tokens if tokens.empty? + compacted = compact_whitespace_tokens(tokens) + optimized = [] #: Array[untyped] current_text = "" current_context = nil - tokens.each do |type, value, context| + compacted.each do |type, value, context| if type == :text current_text += value current_context ||= context @@ -384,6 +388,56 @@ def optimize_tokens(tokens) optimized end + def compact_whitespace_tokens(tokens) + return tokens if tokens.empty? + + tokens.map.with_index { |token, index| + next token unless token[0] == :whitespace + + next nil if adjacent_whitespace?(tokens, index) + next nil if whitespace_before_code_sequence?(tokens, index) + + [:text, token[1], token[2]] + }.compact + end + + def adjacent_whitespace?(tokens, index) + prev_token = index.positive? ? tokens[index - 1] : nil + next_token = index < tokens.length - 1 ? tokens[index + 1] : nil + + trailing_whitespace?(prev_token) || leading_whitespace?(next_token) + end + + def trailing_whitespace?(token) + return false unless token + + token[0] == :whitespace || (token[0] == :text && token[1] =~ /\s\z/) + end + + def leading_whitespace?(token) + token && token[0] == :text && token[1] =~ /\A\s/ + end + + def whitespace_before_code_sequence?(tokens, current_index) + previous_token = tokens[current_index - 1] if current_index.positive? + + return false unless previous_token && previous_token[0] == :code + + token_before_code = find_token_before_code_sequence(tokens, current_index) + + return false unless token_before_code + + trailing_whitespace?(token_before_code) + end + + def find_token_before_code_sequence(tokens, whitespace_index) + search_index = whitespace_index - 1 + + search_index -= 1 while search_index >= 0 && tokens[search_index][0] == :code + + search_index >= 0 ? tokens[search_index] : nil + end + def process_erb_output(opening, code) should_escape = should_escape_output?(opening) add_expression_with_escaping(code, should_escape) @@ -402,8 +456,69 @@ def add_expression_with_escaping(code, should_escape) end end - def handle_whitespace_trimming(node) - @trim_next_whitespace = true if node.tag_closing&.value == "-%>" + def at_line_start? + @tokens.empty? || + @tokens.last[0] != :text || + @tokens.last[1].empty? || + @tokens.last[1].end_with?("\n") || + @tokens.last[1] =~ /\A[ \t]+\z/ || + @tokens.last[1] =~ /\n[ \t]+\z/ + end + + def extract_lspace + return "" unless @tokens.last && @tokens.last[0] == :text + + text = @tokens.last[1] + + return Regexp.last_match(1) if text =~ /\n([ \t]+)\z/ || text =~ /\A([ \t]+)\z/ + + "" + end + + def extract_and_remove_lspace! + lspace = extract_lspace + return lspace if lspace.empty? + + text = @tokens.last[1] + if text =~ /\n[ \t]+\z/ + text.sub!(/[ \t]+\z/, "") + elsif text =~ /\A[ \t]+\z/ + text.replace("") + end + @tokens.last[1] = text + + lspace + end + + def apply_trim(node, code) + has_left_trim = node.tag_opening.value.start_with?("<%-") + node.tag_closing&.value + + remove_trailing_whitespace_from_last_token! if has_left_trim + + if at_line_start? + lspace = extract_and_remove_lspace! + rspace = " \n" + + @tokens << [:code, "#{lspace}#{code}#{rspace}", current_context] + @trim_next_whitespace = true + else + @tokens << [:code, code, current_context] + end + end + + def remove_trailing_whitespace_from_last_token! + return unless @tokens.last && @tokens.last[0] == :text + + text = @tokens.last[1] + + if text =~ /\n[ \t]+\z/ + text.sub!(/[ \t]+\z/, "") + @tokens.last[1] = text + elsif text =~ /\A[ \t]+\z/ + text.replace("") + @tokens.last[1] = text + end end end end diff --git a/lib/herb/engine/debug_visitor.rb b/lib/herb/engine/debug_visitor.rb index fdef692ad..568244199 100644 --- a/lib/herb/engine/debug_visitor.rb +++ b/lib/herb/engine/debug_visitor.rb @@ -180,9 +180,7 @@ def add_debug_attributes_to_element(open_tag_node) debug_attributes << create_debug_attribute("data-herb-debug-attach-to-parent", "true") end - debug_attributes.each do |attr| - open_tag_node.children << attr - end + open_tag_node.children.concat(debug_attributes) @debug_attributes_applied = true end @@ -233,9 +231,7 @@ def create_debug_span_for_erb(erb_node) ] debug_attributes << create_debug_attribute("data-herb-debug-line", line.to_s) if line - debug_attributes << create_debug_attribute("data-herb-debug-column", (column + 1).to_s) if column - debug_attributes << create_debug_attribute("style", "display: contents;") tag_name_token = create_token(:tag_name, "span") diff --git a/sig/herb/engine/compiler.rbs b/sig/herb/engine/compiler.rbs index 926dd9e3d..9440abcea 100644 --- a/sig/herb/engine/compiler.rbs +++ b/sig/herb/engine/compiler.rbs @@ -89,6 +89,8 @@ module Herb def add_text: (untyped text) -> untyped + def add_whitespace: (untyped whitespace) -> untyped + def add_code: (untyped code) -> untyped def add_expression: (untyped code) -> untyped @@ -97,13 +99,33 @@ module Herb def optimize_tokens: (untyped tokens) -> untyped + def compact_whitespace_tokens: (untyped tokens) -> untyped + + def adjacent_whitespace?: (untyped tokens, untyped index) -> untyped + + def trailing_whitespace?: (untyped token) -> untyped + + def leading_whitespace?: (untyped token) -> untyped + + def whitespace_before_code_sequence?: (untyped tokens, untyped current_index) -> untyped + + def find_token_before_code_sequence: (untyped tokens, untyped whitespace_index) -> untyped + def process_erb_output: (untyped opening, untyped code) -> untyped def should_escape_output?: (untyped opening) -> untyped def add_expression_with_escaping: (untyped code, untyped should_escape) -> untyped - def handle_whitespace_trimming: (untyped node) -> untyped + def at_line_start?: () -> untyped + + def extract_lspace: () -> untyped + + def extract_and_remove_lspace!: () -> untyped + + def apply_trim: (untyped node, untyped code) -> untyped + + def remove_trailing_whitespace_from_last_token!: () -> untyped end end end diff --git a/sig/herb_c_extension.rbs b/sig/herb_c_extension.rbs index e5c3c05f1..1f285ca5b 100644 --- a/sig/herb_c_extension.rbs +++ b/sig/herb_c_extension.rbs @@ -2,6 +2,6 @@ # This file is manually maintained - not generated module Herb - def self.parse: (String input) -> ParseResult + def self.parse: (String input, ?track_whitespace: bool) -> ParseResult def self.lex: (String input) -> LexResult end diff --git a/test/engine/cli_test.rb b/test/engine/cli_test.rb index 4ede8e002..3e4e99b38 100644 --- a/test/engine/cli_test.rb +++ b/test/engine/cli_test.rb @@ -274,9 +274,9 @@ def with_temp_file(content) output = captured_output - assert_includes output, "'\n'.freeze" + assert_includes output, "'\n'.freeze" end end diff --git a/test/engine/rails_compatibility_test.rb b/test/engine/rails_compatibility_test.rb index e4e431e3c..236479a65 100644 --- a/test/engine/rails_compatibility_test.rb +++ b/test/engine/rails_compatibility_test.rb @@ -153,7 +153,7 @@ def flush_newline_if_pending(src) engine = RailsHerb.new(template, escape: true) - assert_equal "\n @output_buffer.safe_append='

'.freeze; @output_buffer.append=(@title); @output_buffer.safe_append='

'.freeze;\n@output_buffer", engine.src + assert_equal " @output_buffer.safe_append='

'.freeze; @output_buffer.append=(@title); @output_buffer.safe_append='

'.freeze;\n@output_buffer", engine.src end test "drop-in replacement compatibility" do diff --git a/test/engine/whitespace_trimming_test.rb b/test/engine/whitespace_trimming_test.rb new file mode 100644 index 000000000..aa48c843d --- /dev/null +++ b/test/engine/whitespace_trimming_test.rb @@ -0,0 +1,152 @@ +# frozen_string_literal: true + +require_relative "../test_helper" +require_relative "../../lib/herb/engine" + +module Engine + class WhitespaceTrimmingTest < Minitest::Spec + include SnapshotUtils + + test "left trim removes preceding whitespace" do + template = <<~ERB + <%- if true %> +

Content

+ <%- end %> + ERB + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "right trim removes following newline" do + template = <<~ERB + <% if true -%> +

Content

+ <% end -%> + ERB + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "left and right trim" do + template = <<~ERB + <%- if true -%> +

Content

+ <%- end -%> + ERB + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "left trim with whitespace on previous line" do + template = "before\n <%- if true %>\nafter\n <%- end %>\nfinal" + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "right trim with whitespace on following line" do + template = "before\n <% if true -%>\nafter\n <% end -%>\nfinal" + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "left trim does not affect non-whitespace content" do + template = "text<%- if true %>content<%- end %>" + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "right trim does not affect non-newline content" do + template = "<% if true -%>text<% end -%>more" + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "multiple consecutive trimmed tags" do + template = <<~ERB + <%- if true -%> + <%- if true -%> +

Content

+ <%- end -%> + <%- end -%> + ERB + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "left trim with expressions" do + template = <<~ERB + <%- name = "World" %> + Hello <%- name %> + ERB + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "right trim with expressions" do + template = <<~ERB + <% name = "World" -%> + Hello <%= name %> + ERB + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "left and right trim with expressions" do + template = <<~ERB + <%- name = "World" -%> + Hello <%- name -%> + ERB + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "no trim preserves whitespace" do + template = <<~ERB + <% if true %> +

Content

+ <% end %> + ERB + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "trim with nested blocks" do + template = <<~ERB + <%- [1, 2, 3].each do |i| -%> + <%- if i > 1 -%> +

<%- i -%>

+ <%- end -%> + <%- end -%> + ERB + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "left trim at start of file" do + template = "<%- if true %>\nContent\n<%- end %>" + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + + test "right trim at end of file" do + template = "<% if true -%>\nContent\n<% end -%>" + + assert_compiled_snapshot(template) + assert_evaluated_snapshot(template, enforce_erubi_equality: true) + end + end +end diff --git a/test/engine_visitors_test.rb b/test/engine_visitors_test.rb index 9292dfbc8..4ec0176f0 100644 --- a/test/engine_visitors_test.rb +++ b/test/engine_visitors_test.rb @@ -8,7 +8,7 @@ class EngineVisitorsTest < Minitest::Spec engine = Herb::Engine.new(html) - expected = "_buf = ::String.new;\n _buf << '
Hello World
'.freeze;\n_buf.to_s\n" + expected = "_buf = ::String.new; _buf << '
Hello World
'.freeze;\n_buf.to_s\n" assert_equal expected, engine.src end @@ -47,7 +47,7 @@ class EngineVisitorsTest < Minitest::Spec assert_equal ["visitor1", "visitor2"], execution_order - expected = "_buf = ::String.new;\n _buf << '
Test
'.freeze;\n_buf.to_s\n" + expected = "_buf = ::String.new; _buf << '
Test
'.freeze;\n_buf.to_s\n" assert_equal expected, engine.src end diff --git a/test/snapshot_utils.rb b/test/snapshot_utils.rb index 4a2b5b6f6..396e8134a 100644 --- a/test/snapshot_utils.rb +++ b/test/snapshot_utils.rb @@ -47,7 +47,7 @@ def assert_compiled_snapshot(source, options = {}, **kwargs) assert_snapshot_matches(expected, snapshot_key) if should_compare_with_erubi? || enforce_erubi_equality - compare_with_erubi_compiled(source, engine.src, engine_options, enforce_erubi_equality) + compare_with_erubi_compiled(source, engine.src, engine_options, enforce_equality: enforce_erubi_equality) end engine @@ -77,7 +77,7 @@ def assert_evaluated_snapshot(source, locals = {}, options = {}, **kwargs) assert_snapshot_matches(result, snapshot_key) if should_compare_with_erubi? || enforce_erubi_equality - compare_with_erubi_evaluated(source, result, locals, engine_options, enforce_erubi_equality) + compare_with_erubi_evaluated(source, result, locals, engine_options, enforce_equality: enforce_erubi_equality) end { engine: engine, result: result } diff --git a/test/snapshots/analyze/if_test/test_0011_guard_clause_with_return_if_modifier_6a92e7d29b0b8ff99771a96e90f4ac10.txt b/test/snapshots/analyze/if_test/test_0011_guard_clause_with_return_if_modifier_6a92e7d29b0b8ff99771a96e90f4ac10.txt deleted file mode 100644 index 669f87f9b..000000000 --- a/test/snapshots/analyze/if_test/test_0011_guard_clause_with_return_if_modifier_6a92e7d29b0b8ff99771a96e90f4ac10.txt +++ /dev/null @@ -1,66 +0,0 @@ ---- -source: "Analyze::IfTest#test_0011_guard clause with return if modifier" -input: |2- -<% def some_method %> - <% return if true %> -
This won't render
-<% end %> ---- -@ DocumentNode (location: (1:0)-(5:0)) -└── children: (8 items) - ├── @ ERBContentNode (location: (1:0)-(1:21)) - │ ├── tag_opening: "<%" (location: (1:0)-(1:2)) - │ ├── content: " def some_method " (location: (1:2)-(1:19)) - │ ├── tag_closing: "%>" (location: (1:19)-(1:21)) - │ ├── parsed: true - │ └── valid: false - │ - ├── @ HTMLTextNode (location: (1:21)-(2:2)) - │ └── content: "\n " - │ - ├── @ ERBContentNode (location: (2:2)-(2:22)) - │ ├── tag_opening: "<%" (location: (2:2)-(2:4)) - │ ├── content: " return if true " (location: (2:4)-(2:20)) - │ ├── tag_closing: "%>" (location: (2:20)-(2:22)) - │ ├── parsed: true - │ └── valid: true - │ - ├── @ HTMLTextNode (location: (2:22)-(3:2)) - │ └── content: "\n " - │ - ├── @ HTMLElementNode (location: (3:2)-(3:30)) - │ ├── open_tag: - │ │ └── @ HTMLOpenTagNode (location: (3:2)-(3:7)) - │ │ ├── tag_opening: "<" (location: (3:2)-(3:3)) - │ │ ├── tag_name: "div" (location: (3:3)-(3:6)) - │ │ ├── tag_closing: ">" (location: (3:6)-(3:7)) - │ │ ├── children: [] - │ │ └── is_void: false - │ │ - │ ├── tag_name: "div" (location: (3:3)-(3:6)) - │ ├── body: (1 item) - │ │ └── @ HTMLTextNode (location: (3:7)-(3:24)) - │ │ └── content: "This won't render" - │ │ - │ ├── close_tag: - │ │ └── @ HTMLCloseTagNode (location: (3:24)-(3:30)) - │ │ ├── tag_opening: "" (location: (3:29)-(3:30)) - │ │ - │ ├── is_void: false - │ └── source: "HTML" - │ - ├── @ HTMLTextNode (location: (3:30)-(4:0)) - │ └── content: "\n" - │ - ├── @ ERBContentNode (location: (4:0)-(4:9)) - │ ├── tag_opening: "<%" (location: (4:0)-(4:2)) - │ ├── content: " end " (location: (4:2)-(4:7)) - │ ├── tag_closing: "%>" (location: (4:7)-(4:9)) - │ ├── parsed: true - │ └── valid: false - │ - └── @ HTMLTextNode (location: (4:9)-(5:0)) - └── content: "\n" \ No newline at end of file diff --git a/test/snapshots/engine/block_comments_test/test_0001_ruby_block_comments_with_=begin_and_=end_multiline_ff404c4e708f59f532b4042441e458ad.txt b/test/snapshots/engine/block_comments_test/test_0001_ruby_block_comments_with_=begin_and_=end_multiline_ff404c4e708f59f532b4042441e458ad.txt index 65f8e4403..1bde0c723 100644 --- a/test/snapshots/engine/block_comments_test/test_0001_ruby_block_comments_with_=begin_and_=end_multiline_ff404c4e708f59f532b4042441e458ad.txt +++ b/test/snapshots/engine/block_comments_test/test_0001_ruby_block_comments_with_=begin_and_=end_multiline_ff404c4e708f59f532b4042441e458ad.txt @@ -3,13 +3,12 @@ source: "Engine::BlockCommentsTest#test_0001_ruby block comments with =begin and input: "{source: \"<%\\n=begin %>\\n This, while unusual, is a legal form of commenting.\\n<%\\n=end %>\\n
Hey there
\\n\", options: {}}" --- _buf = ::String.new; +=begin -=begin - _buf << ' - This, while unusual, is a legal form of commenting. + _buf << ' This, while unusual, is a legal form of commenting. '.freeze; -=end - _buf << ' -
Hey there
+=end + + _buf << '
Hey there
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/block_comments_test/test_0002_ruby_block_comments_inside_erb_tags_95bcfa3f3e28634bf923f18df0cd38a1.txt b/test/snapshots/engine/block_comments_test/test_0002_ruby_block_comments_inside_erb_tags_95bcfa3f3e28634bf923f18df0cd38a1.txt index 80aa8e7b7..26d9b7e78 100644 --- a/test/snapshots/engine/block_comments_test/test_0002_ruby_block_comments_inside_erb_tags_95bcfa3f3e28634bf923f18df0cd38a1.txt +++ b/test/snapshots/engine/block_comments_test/test_0002_ruby_block_comments_inside_erb_tags_95bcfa3f3e28634bf923f18df0cd38a1.txt @@ -3,11 +3,10 @@ source: "Engine::BlockCommentsTest#test_0002_ruby block comments inside erb tags input: "{source: \"<%\\n=begin\\nThis is a comment\\n=end\\n%>\\n

Content

\\n\", options: {}}" --- _buf = ::String.new; - =begin This is a comment -=end - _buf << ' -

Content

+=end + + _buf << '

Content

'.freeze; _buf.to_s diff --git a/test/snapshots/engine/block_comments_test/test_0003_ruby_block_comments_with_code_before_and_after_0ee0ba8a9a25359175b884cf66f37b2c.txt b/test/snapshots/engine/block_comments_test/test_0003_ruby_block_comments_with_code_before_and_after_0ee0ba8a9a25359175b884cf66f37b2c.txt index e13a88cc2..a99b44c90 100644 --- a/test/snapshots/engine/block_comments_test/test_0003_ruby_block_comments_with_code_before_and_after_0ee0ba8a9a25359175b884cf66f37b2c.txt +++ b/test/snapshots/engine/block_comments_test/test_0003_ruby_block_comments_with_code_before_and_after_0ee0ba8a9a25359175b884cf66f37b2c.txt @@ -2,15 +2,14 @@ source: "Engine::BlockCommentsTest#test_0003_ruby block comments with code before and after" input: "{source: \"<% x = 1 %>\\n<%\\n=begin\\nMulti-line comment\\nspanning multiple lines\\n=end\\n%>\\n<% y = 2 %>\\n
<%= x + y %>
\\n\", options: {}}" --- -_buf = ::String.new; - x = 1; _buf << ' -'.freeze; +_buf = ::String.new; x = 1 + =begin Multi-line comment spanning multiple lines -=end - _buf << ' -'.freeze; y = 2; _buf << ' -
'.freeze; _buf << (x + y).to_s; _buf << '
+=end + + y = 2 + _buf << '
'.freeze; _buf << (x + y).to_s; _buf << '
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/block_comments_test/test_0004_evaluation_ruby_block_comments_with_=begin_and_=end_mutliline_6bf3affa07b559b73f6428e0dbd270d2.txt b/test/snapshots/engine/block_comments_test/test_0004_evaluation_ruby_block_comments_with_=begin_and_=end_mutliline_6bf3affa07b559b73f6428e0dbd270d2.txt index e9769ee8a..7b3d8c8d4 100644 --- a/test/snapshots/engine/block_comments_test/test_0004_evaluation_ruby_block_comments_with_=begin_and_=end_mutliline_6bf3affa07b559b73f6428e0dbd270d2.txt +++ b/test/snapshots/engine/block_comments_test/test_0004_evaluation_ruby_block_comments_with_=begin_and_=end_mutliline_6bf3affa07b559b73f6428e0dbd270d2.txt @@ -2,5 +2,4 @@ source: "Engine::BlockCommentsTest#test_0004_evaluation: ruby block comments with =begin and =end mutliline" input: "{source: \"<%\\n=begin %>\\n This, while unusual, is a legal form of commenting.\\n<%\\n=end %>\\n
Hey there
\\n\", locals: {}, options: {}}" --- -
Hey there
diff --git a/test/snapshots/engine/block_comments_test/test_0005_evaluation_ruby_block_comments_inside_erb_tags_8a842d797202d0b31c9832cd43a22686.txt b/test/snapshots/engine/block_comments_test/test_0005_evaluation_ruby_block_comments_inside_erb_tags_8a842d797202d0b31c9832cd43a22686.txt index 58c8165c7..a25b60c6f 100644 --- a/test/snapshots/engine/block_comments_test/test_0005_evaluation_ruby_block_comments_inside_erb_tags_8a842d797202d0b31c9832cd43a22686.txt +++ b/test/snapshots/engine/block_comments_test/test_0005_evaluation_ruby_block_comments_inside_erb_tags_8a842d797202d0b31c9832cd43a22686.txt @@ -2,5 +2,4 @@ source: "Engine::BlockCommentsTest#test_0005_evaluation: ruby block comments inside erb tags" input: "{source: \"<%\\n=begin\\nThis is a comment\\n=end\\n%>\\n

Content

\\n\", locals: {}, options: {}}" --- -

Content

diff --git a/test/snapshots/engine/block_comments_test/test_0006_evaluation_ruby_block_comments_with_code_before_and_after_c5e6a4e1e9e691af8dcc74ae6c9564c9.txt b/test/snapshots/engine/block_comments_test/test_0006_evaluation_ruby_block_comments_with_code_before_and_after_c5e6a4e1e9e691af8dcc74ae6c9564c9.txt index 629a3de62..394a34be0 100644 --- a/test/snapshots/engine/block_comments_test/test_0006_evaluation_ruby_block_comments_with_code_before_and_after_c5e6a4e1e9e691af8dcc74ae6c9564c9.txt +++ b/test/snapshots/engine/block_comments_test/test_0006_evaluation_ruby_block_comments_with_code_before_and_after_c5e6a4e1e9e691af8dcc74ae6c9564c9.txt @@ -2,7 +2,4 @@ source: "Engine::BlockCommentsTest#test_0006_evaluation: ruby block comments with code before and after" input: "{source: \"<% x = 1 %>\\n<%\\n=begin\\nMulti-line comment\\nspanning multiple lines\\n=end\\n%>\\n<% y = 2 %>\\n
<%= x + y %>
\\n\", locals: {x: 1, y: 2}, options: {}}" --- - - -
3
diff --git a/test/snapshots/engine/block_comments_test/test_0007_ruby_block_comments_with_=begin_and_=end_mutliline_and_no_space_before_ERB_closing_tag_72379778fa34572e48b949a780f761b1.txt b/test/snapshots/engine/block_comments_test/test_0007_ruby_block_comments_with_=begin_and_=end_mutliline_and_no_space_before_ERB_closing_tag_72379778fa34572e48b949a780f761b1.txt index 37d41a5be..adb7e49a9 100644 --- a/test/snapshots/engine/block_comments_test/test_0007_ruby_block_comments_with_=begin_and_=end_mutliline_and_no_space_before_ERB_closing_tag_72379778fa34572e48b949a780f761b1.txt +++ b/test/snapshots/engine/block_comments_test/test_0007_ruby_block_comments_with_=begin_and_=end_mutliline_and_no_space_before_ERB_closing_tag_72379778fa34572e48b949a780f761b1.txt @@ -3,13 +3,12 @@ source: "Engine::BlockCommentsTest#test_0007_ruby block comments with =begin and input: "{source: \"<%\\n=begin%>\\n This, while unusual, is a legal form of commenting.\\n<%\\n=end%>\\n
Hey there
\\n\", options: {}}" --- _buf = ::String.new; +=begin -=begin - _buf << ' - This, while unusual, is a legal form of commenting. + _buf << ' This, while unusual, is a legal form of commenting. '.freeze; -=end - _buf << ' -
Hey there
+=end + + _buf << '
Hey there
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/block_comments_test/test_0007_ruby_block_comments_with_=begin_and_=end_mutliline_and_no_space_before_ERB_closing_tag_e1b62f3b00e8efb6cac1e5842461de10.txt b/test/snapshots/engine/block_comments_test/test_0007_ruby_block_comments_with_=begin_and_=end_mutliline_and_no_space_before_ERB_closing_tag_e1b62f3b00e8efb6cac1e5842461de10.txt index 4e4bbb95d..d6167bf96 100644 --- a/test/snapshots/engine/block_comments_test/test_0007_ruby_block_comments_with_=begin_and_=end_mutliline_and_no_space_before_ERB_closing_tag_e1b62f3b00e8efb6cac1e5842461de10.txt +++ b/test/snapshots/engine/block_comments_test/test_0007_ruby_block_comments_with_=begin_and_=end_mutliline_and_no_space_before_ERB_closing_tag_e1b62f3b00e8efb6cac1e5842461de10.txt @@ -2,5 +2,4 @@ source: "Engine::BlockCommentsTest#test_0007_ruby block comments with =begin and =end mutliline and no space before ERB closing tag" input: "{source: \"<%\\n=begin%>\\n This, while unusual, is a legal form of commenting.\\n<%\\n=end%>\\n
Hey there
\\n\", locals: {}, options: {}}" --- -
Hey there
diff --git a/test/snapshots/engine/debug_mode_test/test_0001_debug_mode_disabled_by_default_1ae6b8eb8b1931a65192bc14b7593e1c.txt b/test/snapshots/engine/debug_mode_test/test_0001_debug_mode_disabled_by_default_1ae6b8eb8b1931a65192bc14b7593e1c.txt index 7b7f9fca2..5819c1271 100644 --- a/test/snapshots/engine/debug_mode_test/test_0001_debug_mode_disabled_by_default_1ae6b8eb8b1931a65192bc14b7593e1c.txt +++ b/test/snapshots/engine/debug_mode_test/test_0001_debug_mode_disabled_by_default_1ae6b8eb8b1931a65192bc14b7593e1c.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0001_debug mode disabled by default" input: "{source: \"

Hello <%= @name %>!

\", options: {}}" --- -_buf = ::String.new; - _buf << '

Hello '.freeze; _buf << (@name).to_s; _buf << '!

'.freeze; +_buf = ::String.new; _buf << '

Hello '.freeze; _buf << (@name).to_s; _buf << '!

'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0002_debug_mode_enabled_71a0c34d23cde4f85d84b577b3ac6e86.txt b/test/snapshots/engine/debug_mode_test/test_0002_debug_mode_enabled_71a0c34d23cde4f85d84b577b3ac6e86.txt index 54f1b7e40..a923af70c 100644 --- a/test/snapshots/engine/debug_mode_test/test_0002_debug_mode_enabled_71a0c34d23cde4f85d84b577b3ac6e86.txt +++ b/test/snapshots/engine/debug_mode_test/test_0002_debug_mode_enabled_71a0c34d23cde4f85d84b577b3ac6e86.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0002_debug mode enabled" input: "{source: \"

Hello <%= @name %>!

\", options: {debug: true}}" --- -_buf = ::String.new; - _buf << '

Hello '.freeze; _buf << (@name).to_s; _buf << '!

'.freeze; +_buf = ::String.new; _buf << '

Hello '.freeze; _buf << (@name).to_s; _buf << '!

'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0003_debug_mode_options_831362fdf630e5facad634abab817ddd.txt b/test/snapshots/engine/debug_mode_test/test_0003_debug_mode_options_831362fdf630e5facad634abab817ddd.txt index 7e5bc82cd..c8be76f8d 100644 --- a/test/snapshots/engine/debug_mode_test/test_0003_debug_mode_options_831362fdf630e5facad634abab817ddd.txt +++ b/test/snapshots/engine/debug_mode_test/test_0003_debug_mode_options_831362fdf630e5facad634abab817ddd.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0003_debug mode options" input: "{source: \"
Test
\", options: {debug: true, filename: \"app/views/test.html.erb\"}}" --- -_buf = ::String.new; - _buf << '
Test
'.freeze; +_buf = ::String.new; _buf << '
Test
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0004_visible_erb_expression_gets_debug_span_9431501e9722fe8b38c66468fd77c1f5.txt b/test/snapshots/engine/debug_mode_test/test_0004_visible_erb_expression_gets_debug_span_9431501e9722fe8b38c66468fd77c1f5.txt index ad06d3be8..732ab4253 100644 --- a/test/snapshots/engine/debug_mode_test/test_0004_visible_erb_expression_gets_debug_span_9431501e9722fe8b38c66468fd77c1f5.txt +++ b/test/snapshots/engine/debug_mode_test/test_0004_visible_erb_expression_gets_debug_span_9431501e9722fe8b38c66468fd77c1f5.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0004_visible erb expression gets debug span" input: "{source: \"

Welcome <%= @user.name %>!

\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << '

Welcome '.freeze; _buf << (@user.name).to_s; _buf << '!

'.freeze; +_buf = ::String.new; _buf << '

Welcome '.freeze; _buf << (@user.name).to_s; _buf << '!

'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0005_multiple_visible_erb_expressions_get_debug_spans_78e7fde7b24d6ebbef7b0cc3e02dfeeb.txt b/test/snapshots/engine/debug_mode_test/test_0005_multiple_visible_erb_expressions_get_debug_spans_78e7fde7b24d6ebbef7b0cc3e02dfeeb.txt index 3dc1a6c9f..82976219c 100644 --- a/test/snapshots/engine/debug_mode_test/test_0005_multiple_visible_erb_expressions_get_debug_spans_78e7fde7b24d6ebbef7b0cc3e02dfeeb.txt +++ b/test/snapshots/engine/debug_mode_test/test_0005_multiple_visible_erb_expressions_get_debug_spans_78e7fde7b24d6ebbef7b0cc3e02dfeeb.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0005_multiple visible erb expressions get debug spans" input: "{source: \"

Hello <%= @name %> on <%= Date.today %>!

\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << '

Hello '.freeze; _buf << (@name).to_s; _buf << ' on '.freeze; _buf << (Date.today).to_s; _buf << '!

'.freeze; +_buf = ::String.new; _buf << '

Hello '.freeze; _buf << (@name).to_s; _buf << ' on '.freeze; _buf << (Date.today).to_s; _buf << '!

'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0006_attribute_erb_expressions_do_NOT_get_debug_spans_9827f669a2c87b0da29ee3e73f2485a8.txt b/test/snapshots/engine/debug_mode_test/test_0006_attribute_erb_expressions_do_NOT_get_debug_spans_9827f669a2c87b0da29ee3e73f2485a8.txt index 3cd1d38a5..7512efd6f 100644 --- a/test/snapshots/engine/debug_mode_test/test_0006_attribute_erb_expressions_do_NOT_get_debug_spans_9827f669a2c87b0da29ee3e73f2485a8.txt +++ b/test/snapshots/engine/debug_mode_test/test_0006_attribute_erb_expressions_do_NOT_get_debug_spans_9827f669a2c87b0da29ee3e73f2485a8.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0006_attribute erb expressions do NOT get debug spans" input: "{source: \"
\\\" data-id=\\\"<%= @user.id %>\\\">Content
\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << '
Content
'.freeze; +_buf = ::String.new; _buf << '
Content
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0007_script_content_erb_expressions_do_NOT_get_debug_spans_fa19152dbae94261cb892c6fe543ee74.txt b/test/snapshots/engine/debug_mode_test/test_0007_script_content_erb_expressions_do_NOT_get_debug_spans_fa19152dbae94261cb892c6fe543ee74.txt index 0cbd20c82..ad92183d8 100644 --- a/test/snapshots/engine/debug_mode_test/test_0007_script_content_erb_expressions_do_NOT_get_debug_spans_fa19152dbae94261cb892c6fe543ee74.txt +++ b/test/snapshots/engine/debug_mode_test/test_0007_script_content_erb_expressions_do_NOT_get_debug_spans_fa19152dbae94261cb892c6fe543ee74.txt @@ -2,8 +2,7 @@ source: "Engine::DebugModeTest#test_0007_script content erb expressions do NOT get debug spans" input: "{source: \"\\n\", options: {debug: true}}" --- -_buf = ::String.new; - _buf << ' diff --git a/test/snapshots/engine/debug_mode_test/test_0008_style_content_erb_expressions_do_NOT_get_debug_spans_841ac66ea0f03edd85fe096706e27292.txt b/test/snapshots/engine/debug_mode_test/test_0008_style_content_erb_expressions_do_NOT_get_debug_spans_841ac66ea0f03edd85fe096706e27292.txt index c7ac08db5..e8b9ac45c 100644 --- a/test/snapshots/engine/debug_mode_test/test_0008_style_content_erb_expressions_do_NOT_get_debug_spans_841ac66ea0f03edd85fe096706e27292.txt +++ b/test/snapshots/engine/debug_mode_test/test_0008_style_content_erb_expressions_do_NOT_get_debug_spans_841ac66ea0f03edd85fe096706e27292.txt @@ -2,8 +2,7 @@ source: "Engine::DebugModeTest#test_0008_style content erb expressions do NOT get debug spans" input: "{source: \"\\n\", options: {debug: true}}" --- -_buf = ::String.new; - _buf << ' diff --git a/test/snapshots/engine/debug_mode_test/test_0009_render_calls_get_outline_boundaries_48fc68664d9cabb3813ea9b86d3f8bbd.txt b/test/snapshots/engine/debug_mode_test/test_0009_render_calls_get_outline_boundaries_48fc68664d9cabb3813ea9b86d3f8bbd.txt index b4e21c285..ac0854a3a 100644 --- a/test/snapshots/engine/debug_mode_test/test_0009_render_calls_get_outline_boundaries_48fc68664d9cabb3813ea9b86d3f8bbd.txt +++ b/test/snapshots/engine/debug_mode_test/test_0009_render_calls_get_outline_boundaries_48fc68664d9cabb3813ea9b86d3f8bbd.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0009_render calls get outline boundaries" input: "{source: \"<%= render \\\"shared/header\\\" %>\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << (render "shared/header").to_s; +_buf = ::String.new; _buf << (render "shared/header").to_s; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0010_partial_render_calls_get_partial_outline_boundaries_15153b8ec3486c918ba9fcb33386aeee.txt b/test/snapshots/engine/debug_mode_test/test_0010_partial_render_calls_get_partial_outline_boundaries_15153b8ec3486c918ba9fcb33386aeee.txt index 6917e0335..b0f2ebf7b 100644 --- a/test/snapshots/engine/debug_mode_test/test_0010_partial_render_calls_get_partial_outline_boundaries_15153b8ec3486c918ba9fcb33386aeee.txt +++ b/test/snapshots/engine/debug_mode_test/test_0010_partial_render_calls_get_partial_outline_boundaries_15153b8ec3486c918ba9fcb33386aeee.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0010_partial render calls get partial outline boundaries" input: "{source: \"<%= render partial: \\\"user_card\\\", locals: { user: @user } %>\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << (render partial: "user_card", locals: { user: @user }).to_s; +_buf = ::String.new; _buf << (render partial: "user_card", locals: { user: @user }).to_s; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0011_top-level_element_with_only_ERB_output_as_child_683f80e816cdd50d5e065d1e91bcce53.txt b/test/snapshots/engine/debug_mode_test/test_0011_top-level_element_with_only_ERB_output_as_child_683f80e816cdd50d5e065d1e91bcce53.txt index 5a1d6496c..cadbcb53b 100644 --- a/test/snapshots/engine/debug_mode_test/test_0011_top-level_element_with_only_ERB_output_as_child_683f80e816cdd50d5e065d1e91bcce53.txt +++ b/test/snapshots/engine/debug_mode_test/test_0011_top-level_element_with_only_ERB_output_as_child_683f80e816cdd50d5e065d1e91bcce53.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0011_top-level element with only ERB output as child" input: "{source: \"

<%= hello %>

\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << '

'.freeze; _buf << (hello).to_s; _buf << '

'.freeze; +_buf = ::String.new; _buf << '

'.freeze; _buf << (hello).to_s; _buf << '

'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0012_top-level_element_with_only_ERB_output_as_child_for_partial_00b34061b9686a4c930bd9ab0bd4665d.txt b/test/snapshots/engine/debug_mode_test/test_0012_top-level_element_with_only_ERB_output_as_child_for_partial_00b34061b9686a4c930bd9ab0bd4665d.txt index a70767460..df234cd16 100644 --- a/test/snapshots/engine/debug_mode_test/test_0012_top-level_element_with_only_ERB_output_as_child_for_partial_00b34061b9686a4c930bd9ab0bd4665d.txt +++ b/test/snapshots/engine/debug_mode_test/test_0012_top-level_element_with_only_ERB_output_as_child_for_partial_00b34061b9686a4c930bd9ab0bd4665d.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0012_top-level element with only ERB output as child for partial" input: "{source: \"

<%= hello %>

\", options: {debug: true, filename: \"_test.html.erb\"}}" --- -_buf = ::String.new; - _buf << '

'.freeze; _buf << (hello).to_s; _buf << '

'.freeze; +_buf = ::String.new; _buf << '

'.freeze; _buf << (hello).to_s; _buf << '

'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0013_collection_render_calls_get_outline_boundaries_a536d3d2225f6f8d1163956571c1623b.txt b/test/snapshots/engine/debug_mode_test/test_0013_collection_render_calls_get_outline_boundaries_a536d3d2225f6f8d1163956571c1623b.txt index 4eb8041df..f960c6faa 100644 --- a/test/snapshots/engine/debug_mode_test/test_0013_collection_render_calls_get_outline_boundaries_a536d3d2225f6f8d1163956571c1623b.txt +++ b/test/snapshots/engine/debug_mode_test/test_0013_collection_render_calls_get_outline_boundaries_a536d3d2225f6f8d1163956571c1623b.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0013_collection render calls get outline boundaries" input: "{source: \"<%= render @posts %>\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << (render @posts).to_s; +_buf = ::String.new; _buf << (render @posts).to_s; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0014_erb_control_flow_does_NOT_get_debug_markup_b88df3287cc07c730b007a0e6a3aace2.txt b/test/snapshots/engine/debug_mode_test/test_0014_erb_control_flow_does_NOT_get_debug_markup_b88df3287cc07c730b007a0e6a3aace2.txt index 15b02d65b..f3ed156b5 100644 --- a/test/snapshots/engine/debug_mode_test/test_0014_erb_control_flow_does_NOT_get_debug_markup_b88df3287cc07c730b007a0e6a3aace2.txt +++ b/test/snapshots/engine/debug_mode_test/test_0014_erb_control_flow_does_NOT_get_debug_markup_b88df3287cc07c730b007a0e6a3aace2.txt @@ -2,11 +2,9 @@ source: "Engine::DebugModeTest#test_0014_erb control flow does NOT get debug markup" input: "{source: \"<% if @user.present? %>\\n

User found

\\n<% else %>\\n

No user

\\n<% end %>\\n\", options: {debug: true}}" --- -_buf = ::String.new; - if @user.present?; _buf << ' -

User found

-'.freeze; else; _buf << ' -

No user

-'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; if @user.present? + _buf << '

User found

+'.freeze; else + _buf << '

No user

+'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0015_erb_comments_do_NOT_get_debug_markup_07372a921f413dd0d25e4fc4d599e417.txt b/test/snapshots/engine/debug_mode_test/test_0015_erb_comments_do_NOT_get_debug_markup_07372a921f413dd0d25e4fc4d599e417.txt index 92c689e60..388496068 100644 --- a/test/snapshots/engine/debug_mode_test/test_0015_erb_comments_do_NOT_get_debug_markup_07372a921f413dd0d25e4fc4d599e417.txt +++ b/test/snapshots/engine/debug_mode_test/test_0015_erb_comments_do_NOT_get_debug_markup_07372a921f413dd0d25e4fc4d599e417.txt @@ -2,8 +2,7 @@ source: "Engine::DebugModeTest#test_0015_erb comments do NOT get debug markup" input: "{source: \"

Content

\\n<%# This is a comment %>\\n

More content

\\n\", options: {debug: true}}" --- -_buf = ::String.new; - _buf << '

Content

+_buf = ::String.new; _buf << '

Content

More content

'.freeze; diff --git a/test/snapshots/engine/debug_mode_test/test_0016_block_expressions_get_debug_spans_c71ab7a64204c499e9b116ffc3fbf03d.txt b/test/snapshots/engine/debug_mode_test/test_0016_block_expressions_get_debug_spans_c71ab7a64204c499e9b116ffc3fbf03d.txt index 5190e87fe..8abb6cca5 100644 --- a/test/snapshots/engine/debug_mode_test/test_0016_block_expressions_get_debug_spans_c71ab7a64204c499e9b116ffc3fbf03d.txt +++ b/test/snapshots/engine/debug_mode_test/test_0016_block_expressions_get_debug_spans_c71ab7a64204c499e9b116ffc3fbf03d.txt @@ -2,9 +2,7 @@ source: "Engine::DebugModeTest#test_0016_block expressions get debug spans" input: "{source: \"<%= content_for :sidebar do %>\\n
Sidebar content
\\n<% end %>\\n\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << content_for :sidebar do; _buf << ' +_buf = ::String.new; _buf << content_for :sidebar do; _buf << '
Sidebar content
-'.freeze; end; _buf << ' -'.freeze; +'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0017_render_block_expressions_get_outline_boundaries_a8600827a6adf41bc60a28a65a7ebe50.txt b/test/snapshots/engine/debug_mode_test/test_0017_render_block_expressions_get_outline_boundaries_a8600827a6adf41bc60a28a65a7ebe50.txt index 1bff2e5cd..1f0361d85 100644 --- a/test/snapshots/engine/debug_mode_test/test_0017_render_block_expressions_get_outline_boundaries_a8600827a6adf41bc60a28a65a7ebe50.txt +++ b/test/snapshots/engine/debug_mode_test/test_0017_render_block_expressions_get_outline_boundaries_a8600827a6adf41bc60a28a65a7ebe50.txt @@ -2,9 +2,7 @@ source: "Engine::DebugModeTest#test_0017_render block expressions get outline boundaries" input: "{source: \"<%= render \\\"layout\\\" do %>\\n
Block content
\\n<% end %>\\n\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << render "layout" do; _buf << ' +_buf = ::String.new; _buf << render "layout" do; _buf << '
Block content
-'.freeze; end; _buf << ' -'.freeze; +'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0018_mixed_content_and_attributes_a900dc734c9ad44f41ee0df5f88e0e68.txt b/test/snapshots/engine/debug_mode_test/test_0018_mixed_content_and_attributes_a900dc734c9ad44f41ee0df5f88e0e68.txt index 85c28fc02..fd59b72d3 100644 --- a/test/snapshots/engine/debug_mode_test/test_0018_mixed_content_and_attributes_a900dc734c9ad44f41ee0df5f88e0e68.txt +++ b/test/snapshots/engine/debug_mode_test/test_0018_mixed_content_and_attributes_a900dc734c9ad44f41ee0df5f88e0e68.txt @@ -2,8 +2,7 @@ source: "Engine::DebugModeTest#test_0018_mixed content and attributes" input: "{source: \"
\\\">\\n

Hello <%= @name %>!

\\n

\\\">Today is <%= Date.today.strftime('%A') %>

\\n
\\n\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << '
+_buf = ::String.new; _buf << '

Hello '.freeze; _buf << (@name).to_s; _buf << '!

Today is '.freeze; _buf << (Date.today.strftime('%A')).to_s; _buf << '

diff --git a/test/snapshots/engine/debug_mode_test/test_0019_nested_erb_expressions_with_render_calls_9ff80d616cac6cd6536d9d1c69828d42.txt b/test/snapshots/engine/debug_mode_test/test_0019_nested_erb_expressions_with_render_calls_9ff80d616cac6cd6536d9d1c69828d42.txt index 94cd55fda..3501af0a3 100644 --- a/test/snapshots/engine/debug_mode_test/test_0019_nested_erb_expressions_with_render_calls_9ff80d616cac6cd6536d9d1c69828d42.txt +++ b/test/snapshots/engine/debug_mode_test/test_0019_nested_erb_expressions_with_render_calls_9ff80d616cac6cd6536d9d1c69828d42.txt @@ -2,8 +2,7 @@ source: "Engine::DebugModeTest#test_0019_nested erb expressions with render calls" input: "{source: \"
\\n

Welcome <%= @user.name %>!

\\n <%= render \\\"shared/navigation\\\" %>\\n
\\n <%= render partial: \\\"content\\\", locals: { data: @data } %>\\n
\\n
\\n\", options: {debug: true, filename: \"app/views/welcome.html.erb\"}}" --- -_buf = ::String.new; - _buf << '
+_buf = ::String.new; _buf << '

Welcome '.freeze; _buf << (@user.name).to_s; _buf << '!

'.freeze; _buf << (render "shared/navigation").to_s; _buf << '
diff --git a/test/snapshots/engine/debug_mode_test/test_0020_debug_mode_with_escape_enabled_ed8d270f96c299d791e00fdbec8726b1.txt b/test/snapshots/engine/debug_mode_test/test_0020_debug_mode_with_escape_enabled_ed8d270f96c299d791e00fdbec8726b1.txt index 7840a4379..b3916905d 100644 --- a/test/snapshots/engine/debug_mode_test/test_0020_debug_mode_with_escape_enabled_ed8d270f96c299d791e00fdbec8726b1.txt +++ b/test/snapshots/engine/debug_mode_test/test_0020_debug_mode_with_escape_enabled_ed8d270f96c299d791e00fdbec8726b1.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0020_debug mode with escape enabled" input: "{source: \"

User input: <%= user_content %>

\", options: {debug: true, escape: true, filename: \"test.html.erb\"}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << '

User input: '.freeze; _buf << __herb.h((user_content)); _buf << '

'.freeze; +__herb = ::Herb::Engine; _buf = ::String.new; _buf << '

User input: '.freeze; _buf << __herb.h((user_content)); _buf << '

'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0021_debug_mode_with_escape_disabled_d5b28d0c6e5cc66787fa0f0134fe2642.txt b/test/snapshots/engine/debug_mode_test/test_0021_debug_mode_with_escape_disabled_d5b28d0c6e5cc66787fa0f0134fe2642.txt index ee7b20292..d3fd7ee6a 100644 --- a/test/snapshots/engine/debug_mode_test/test_0021_debug_mode_with_escape_disabled_d5b28d0c6e5cc66787fa0f0134fe2642.txt +++ b/test/snapshots/engine/debug_mode_test/test_0021_debug_mode_with_escape_disabled_d5b28d0c6e5cc66787fa0f0134fe2642.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0021_debug mode with escape disabled" input: "{source: \"

Safe content: <%= safe_html %>

\", options: {debug: true, escape: false, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << '

Safe content: '.freeze; _buf << (safe_html).to_s; _buf << '

'.freeze; +_buf = ::String.new; _buf << '

Safe content: '.freeze; _buf << (safe_html).to_s; _buf << '

'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0022_erb_yield_expressions_get_debug_spans_00962cc49ea43b8d9e11e5b050b24a56.txt b/test/snapshots/engine/debug_mode_test/test_0022_erb_yield_expressions_get_debug_spans_00962cc49ea43b8d9e11e5b050b24a56.txt index 5d16d48ff..0566afbe2 100644 --- a/test/snapshots/engine/debug_mode_test/test_0022_erb_yield_expressions_get_debug_spans_00962cc49ea43b8d9e11e5b050b24a56.txt +++ b/test/snapshots/engine/debug_mode_test/test_0022_erb_yield_expressions_get_debug_spans_00962cc49ea43b8d9e11e5b050b24a56.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0022_erb yield expressions get debug spans" input: "{source: \"
<%= yield :sidebar %>
\", options: {debug: true, filename: \"layout.erb\"}}" --- -_buf = ::String.new; - _buf << '
'.freeze; _buf << (yield :sidebar).to_s; _buf << '
'.freeze; +_buf = ::String.new; _buf << '
'.freeze; _buf << (yield :sidebar).to_s; _buf << '
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0023_complex_nested_template_with_all_features_8183ba9ca86a867463e5eef28dede268.txt b/test/snapshots/engine/debug_mode_test/test_0023_complex_nested_template_with_all_features_8183ba9ca86a867463e5eef28dede268.txt index 8bcee24c8..41ae03c6c 100644 --- a/test/snapshots/engine/debug_mode_test/test_0023_complex_nested_template_with_all_features_8183ba9ca86a867463e5eef28dede268.txt +++ b/test/snapshots/engine/debug_mode_test/test_0023_complex_nested_template_with_all_features_8183ba9ca86a867463e5eef28dede268.txt @@ -2,8 +2,7 @@ source: "Engine::DebugModeTest#test_0023_complex nested template with all features" input: "{source: \"\\n\\n \\n <%= @page_title %>\\n \\n \\n \\\">\\n <%= render \\\"shared/header\\\" %>\\n\\n
\\n <% if @user.present? %>\\n

Welcome back, <%= @user.name %>!

\\n <%= render partial: \\\"user_dashboard\\\", locals: { user: @user } %>\\n <% else %>\\n

Welcome, guest!

\\n <%= render \\\"auth/login_form\\\" %>\\n <% end %>\\n
\\n\\n \\n \\n\\n\", options: {debug: true, filename: \"app/views/layouts/application.html.erb\"}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << ' '.freeze; _buf << (@page_title).to_s; _buf << ' @@ -15,14 +14,14 @@ _buf = ::String.new; '.freeze; _buf << (render "shared/header").to_s; _buf << '
- '.freeze; if @user.present?; _buf << ' -

Welcome back, '.freeze; _buf << (@user.name).to_s; _buf << '!

+'.freeze; if @user.present? + _buf << '

Welcome back, '.freeze; _buf << (@user.name).to_s; _buf << '!

'.freeze; _buf << (render partial: "user_dashboard", locals: { user: @user }).to_s; _buf << ' - '.freeze; else; _buf << ' -

Welcome, guest!

+'.freeze; else + _buf << '

Welcome, guest!

'.freeze; _buf << (render "auth/login_form").to_s; _buf << ' - '.freeze; end; _buf << ' -
+'.freeze; end + _buf << '
\\n \\n
\\n\", options: {debug: true}}" --- -_buf = ::String.new; - _buf << '
+_buf = ::String.new; _buf << '
diff --git a/test/snapshots/engine/debug_mode_test/test_0042_html_comment_erb_expressions_do_NOT_get_debug_spans_29f280295d96a879bf9775e4ca2509b8.txt b/test/snapshots/engine/debug_mode_test/test_0042_html_comment_erb_expressions_do_NOT_get_debug_spans_29f280295d96a879bf9775e4ca2509b8.txt index f055b6f7a..aa458b99b 100644 --- a/test/snapshots/engine/debug_mode_test/test_0042_html_comment_erb_expressions_do_NOT_get_debug_spans_29f280295d96a879bf9775e4ca2509b8.txt +++ b/test/snapshots/engine/debug_mode_test/test_0042_html_comment_erb_expressions_do_NOT_get_debug_spans_29f280295d96a879bf9775e4ca2509b8.txt @@ -2,8 +2,7 @@ source: "Engine::DebugModeTest#test_0042_html comment erb expressions do NOT get debug spans" input: "{source: \"\\n\\n\", options: {debug: true}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << ' '.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0043_html_doctype_erb_expressions_do_NOT_get_debug_spans_f7e26660aada5f63b9e67e4082fa3efe.txt b/test/snapshots/engine/debug_mode_test/test_0043_html_doctype_erb_expressions_do_NOT_get_debug_spans_f7e26660aada5f63b9e67e4082fa3efe.txt index b88dcfa18..939ebdf0a 100644 --- a/test/snapshots/engine/debug_mode_test/test_0043_html_doctype_erb_expressions_do_NOT_get_debug_spans_f7e26660aada5f63b9e67e4082fa3efe.txt +++ b/test/snapshots/engine/debug_mode_test/test_0043_html_doctype_erb_expressions_do_NOT_get_debug_spans_f7e26660aada5f63b9e67e4082fa3efe.txt @@ -2,8 +2,7 @@ source: "Engine::DebugModeTest#test_0043_html doctype erb expressions do NOT get debug spans" input: "{source: \"\\\">\\n>\\n\", options: {debug: true}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << ' '.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0044_complex_erb_with_control_flow_and_fa_helper_calls_21cbfad3d0a53e094cf337404372e3cc.txt b/test/snapshots/engine/debug_mode_test/test_0044_complex_erb_with_control_flow_and_fa_helper_calls_21cbfad3d0a53e094cf337404372e3cc.txt index bd4fe5deb..908f8de33 100644 --- a/test/snapshots/engine/debug_mode_test/test_0044_complex_erb_with_control_flow_and_fa_helper_calls_21cbfad3d0a53e094cf337404372e3cc.txt +++ b/test/snapshots/engine/debug_mode_test/test_0044_complex_erb_with_control_flow_and_fa_helper_calls_21cbfad3d0a53e094cf337404372e3cc.txt @@ -2,14 +2,13 @@ source: "Engine::DebugModeTest#test_0044_complex erb with control flow and fa helper calls" input: "{source: \"
\\n <% speakers_count = talk.speakers.size %>\\n <% if speakers_count > 1 %>\\n <%= fa(\\\"users\\\", size: :sm, style: :light, class: \\\"shrink-0 grow-0 my-1\\\") %>\\n <% elsif speakers_count == 1 %>\\n <%= fa(\\\"user\\\", size: :sm, style: :regular, class: \\\"shrink-0 grow-0 my-1\\\") %>\\n <% end %>\\n
\\n\", options: {debug: true, filename: \"test.html.erb\"}}" --- -_buf = ::String.new; - _buf << '
- '.freeze; speakers_count = talk.speakers.size; _buf << ' - '.freeze; if speakers_count > 1; _buf << ' - '.freeze; _buf << (fa("users", size: :sm, style: :light, class: "shrink-0 grow-0 my-1")).to_s; _buf << ' - '.freeze; elsif speakers_count == 1; _buf << ' - '.freeze; _buf << (fa("user", size: :sm, style: :regular, class: "shrink-0 grow-0 my-1")).to_s; _buf << ' - '.freeze; end; _buf << ' -
+_buf = ::String.new; _buf << '
+'.freeze; speakers_count = talk.speakers.size + if speakers_count > 1 + _buf << ' '.freeze; _buf << (fa("users", size: :sm, style: :light, class: "shrink-0 grow-0 my-1")).to_s; _buf << ' +'.freeze; elsif speakers_count == 1 + _buf << ' '.freeze; _buf << (fa("user", size: :sm, style: :regular, class: "shrink-0 grow-0 my-1")).to_s; _buf << ' +'.freeze; end + _buf << '
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/debug_mode_test/test_0045_regular_div_content_still_gets_debug_spans_after_excluded_context_tests_8bcb5712e0fc1e7b6a6b8639a98f4e14.txt b/test/snapshots/engine/debug_mode_test/test_0045_regular_div_content_still_gets_debug_spans_after_excluded_context_tests_8bcb5712e0fc1e7b6a6b8639a98f4e14.txt index c82ff1063..1d6100b6a 100644 --- a/test/snapshots/engine/debug_mode_test/test_0045_regular_div_content_still_gets_debug_spans_after_excluded_context_tests_8bcb5712e0fc1e7b6a6b8639a98f4e14.txt +++ b/test/snapshots/engine/debug_mode_test/test_0045_regular_div_content_still_gets_debug_spans_after_excluded_context_tests_8bcb5712e0fc1e7b6a6b8639a98f4e14.txt @@ -2,6 +2,5 @@ source: "Engine::DebugModeTest#test_0045_regular div content still gets debug spans after excluded context tests" input: "{source: \"
<%= @content %>
\", options: {debug: true}}" --- -_buf = ::String.new; - _buf << '
'.freeze; _buf << (@content).to_s; _buf << '
'.freeze; +_buf = ::String.new; _buf << '
'.freeze; _buf << (@content).to_s; _buf << '
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0001_erb_block_expressions_generate_correct_code_without_parentheses_f1ec47d1e1a09d1114d928c64d54de58.txt b/test/snapshots/engine/engine_block_test/test_0001_erb_block_expressions_generate_correct_code_without_parentheses_f1ec47d1e1a09d1114d928c64d54de58.txt index 9514dde2b..efcb6b777 100644 --- a/test/snapshots/engine/engine_block_test/test_0001_erb_block_expressions_generate_correct_code_without_parentheses_f1ec47d1e1a09d1114d928c64d54de58.txt +++ b/test/snapshots/engine/engine_block_test/test_0001_erb_block_expressions_generate_correct_code_without_parentheses_f1ec47d1e1a09d1114d928c64d54de58.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0001_erb block expressions generate correct code without parentheses" input: "{source: \"<%= link_to \\\"/path\\\", class: \\\"btn\\\" do %>Click me<% end %>\", options: {}}" --- -_buf = ::String.new; - _buf << link_to "/path", class: "btn" do; _buf << 'Click me'.freeze; end; +_buf = ::String.new; _buf << link_to "/path", class: "btn" do; _buf << 'Click me'.freeze; end; _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0002_erb_block_expressions_with_escaping_7296abe3ce9cad7a56f653b0669c8e0a.txt b/test/snapshots/engine/engine_block_test/test_0002_erb_block_expressions_with_escaping_7296abe3ce9cad7a56f653b0669c8e0a.txt index 4c9a64cf9..0ebaac891 100644 --- a/test/snapshots/engine/engine_block_test/test_0002_erb_block_expressions_with_escaping_7296abe3ce9cad7a56f653b0669c8e0a.txt +++ b/test/snapshots/engine/engine_block_test/test_0002_erb_block_expressions_with_escaping_7296abe3ce9cad7a56f653b0669c8e0a.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0002_erb block expressions with escaping" input: "{source: \"<%== form_for @user do %>Form content<% end %>\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << ::Herb::Engine.h(form_for @user do); _buf << 'Form content'.freeze; end; +_buf = ::String.new; _buf << ::Herb::Engine.h(form_for @user do); _buf << 'Form content'.freeze; end; _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0003_regular_erb_expressions_have_parentheses_f5a50306423c1234d1f86bef4244b302.txt b/test/snapshots/engine/engine_block_test/test_0003_regular_erb_expressions_have_parentheses_f5a50306423c1234d1f86bef4244b302.txt index 38c4a6c53..9fb4b3637 100644 --- a/test/snapshots/engine/engine_block_test/test_0003_regular_erb_expressions_have_parentheses_f5a50306423c1234d1f86bef4244b302.txt +++ b/test/snapshots/engine/engine_block_test/test_0003_regular_erb_expressions_have_parentheses_f5a50306423c1234d1f86bef4244b302.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0003_regular erb expressions have parentheses" input: "{source: \"<%= user.name %>\", options: {}}" --- -_buf = ::String.new; - _buf << (user.name).to_s; +_buf = ::String.new; _buf << (user.name).to_s; _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0004_escaped_expressions_use_correct_escape_function_767532fe886f09850d3e2117de637a56.txt b/test/snapshots/engine/engine_block_test/test_0004_escaped_expressions_use_correct_escape_function_767532fe886f09850d3e2117de637a56.txt index 0f955f31c..36b9da342 100644 --- a/test/snapshots/engine/engine_block_test/test_0004_escaped_expressions_use_correct_escape_function_767532fe886f09850d3e2117de637a56.txt +++ b/test/snapshots/engine/engine_block_test/test_0004_escaped_expressions_use_correct_escape_function_767532fe886f09850d3e2117de637a56.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0004_escaped expressions use correct escape function" input: "{source: \"<%== \\\"\\\" %>\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << ::Herb::Engine.h(("")); +_buf = ::String.new; _buf << ::Herb::Engine.h(("")); _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0005_escape_function_reference_uses_HerbEngine_7d6fcd9b42b7c23b832eae52e36033ef.txt b/test/snapshots/engine/engine_block_test/test_0005_escape_function_reference_uses_HerbEngine_7d6fcd9b42b7c23b832eae52e36033ef.txt index 87ed70718..28548e4cf 100644 --- a/test/snapshots/engine/engine_block_test/test_0005_escape_function_reference_uses_HerbEngine_7d6fcd9b42b7c23b832eae52e36033ef.txt +++ b/test/snapshots/engine/engine_block_test/test_0005_escape_function_reference_uses_HerbEngine_7d6fcd9b42b7c23b832eae52e36033ef.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0005_escape function reference uses Herb::Engine" input: "{source: \"<%== content %>\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << ::Herb::Engine.h((content)); +_buf = ::String.new; _buf << ::Herb::Engine.h((content)); _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0005_escape_function_reference_uses_HerbEngine_a7a38b365e168de54928cd4b780619ce.txt b/test/snapshots/engine/engine_block_test/test_0005_escape_function_reference_uses_HerbEngine_a7a38b365e168de54928cd4b780619ce.txt index 794a9076e..df48f012d 100644 --- a/test/snapshots/engine/engine_block_test/test_0005_escape_function_reference_uses_HerbEngine_a7a38b365e168de54928cd4b780619ce.txt +++ b/test/snapshots/engine/engine_block_test/test_0005_escape_function_reference_uses_HerbEngine_a7a38b365e168de54928cd4b780619ce.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0005_escape function reference uses Herb::Engine" input: "{source: \"<%= content %>\", options: {escape: true}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << __herb.h((content)); +__herb = ::Herb::Engine; _buf = ::String.new; _buf << __herb.h((content)); _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0006_context-aware_escaping_for_attributes_1a41c1fd03ace896cc730634012d9df9.txt b/test/snapshots/engine/engine_block_test/test_0006_context-aware_escaping_for_attributes_1a41c1fd03ace896cc730634012d9df9.txt index a607ce0b5..bb9548e51 100644 --- a/test/snapshots/engine/engine_block_test/test_0006_context-aware_escaping_for_attributes_1a41c1fd03ace896cc730634012d9df9.txt +++ b/test/snapshots/engine/engine_block_test/test_0006_context-aware_escaping_for_attributes_1a41c1fd03ace896cc730634012d9df9.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0006_context-aware escaping for attributes" input: "{source: \"
\\\">Content
\", options: {}}" --- -_buf = ::String.new; - _buf << '
Content
'.freeze; +_buf = ::String.new; _buf << '
Content
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0007_script_context_escaping_449cb47f122ffe05c8a3938b86db01da.txt b/test/snapshots/engine/engine_block_test/test_0007_script_context_escaping_449cb47f122ffe05c8a3938b86db01da.txt index 9c4832e19..aeb93dfe8 100644 --- a/test/snapshots/engine/engine_block_test/test_0007_script_context_escaping_449cb47f122ffe05c8a3938b86db01da.txt +++ b/test/snapshots/engine/engine_block_test/test_0007_script_context_escaping_449cb47f122ffe05c8a3938b86db01da.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0007_script context escaping" input: "{source: \"\", options: {}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0008_style_context_escaping_a367cd981eadfdc5c6a824c1bdf2694f.txt b/test/snapshots/engine/engine_block_test/test_0008_style_context_escaping_a367cd981eadfdc5c6a824c1bdf2694f.txt index f34ad3782..8591a6efa 100644 --- a/test/snapshots/engine/engine_block_test/test_0008_style_context_escaping_a367cd981eadfdc5c6a824c1bdf2694f.txt +++ b/test/snapshots/engine/engine_block_test/test_0008_style_context_escaping_a367cd981eadfdc5c6a824c1bdf2694f.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0008_style context escaping" input: "{source: \"\", options: {}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0010_html_comments_are_optimized_to_single_text_token_42d9dc7e0c0dd5ae36a7ddde7f11ef75.txt b/test/snapshots/engine/engine_block_test/test_0010_html_comments_are_optimized_to_single_text_token_42d9dc7e0c0dd5ae36a7ddde7f11ef75.txt index b5af057a8..20768318a 100644 --- a/test/snapshots/engine/engine_block_test/test_0010_html_comments_are_optimized_to_single_text_token_42d9dc7e0c0dd5ae36a7ddde7f11ef75.txt +++ b/test/snapshots/engine/engine_block_test/test_0010_html_comments_are_optimized_to_single_text_token_42d9dc7e0c0dd5ae36a7ddde7f11ef75.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0010_html comments are optimized to single text token" input: "{source: \"\", options: {}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0011_doctype_is_optimized_to_single_text_token_e81d630999b5fe77477e60ce788a1e3d.txt b/test/snapshots/engine/engine_block_test/test_0011_doctype_is_optimized_to_single_text_token_e81d630999b5fe77477e60ce788a1e3d.txt index 1251bcecd..c674e66dc 100644 --- a/test/snapshots/engine/engine_block_test/test_0011_doctype_is_optimized_to_single_text_token_e81d630999b5fe77477e60ce788a1e3d.txt +++ b/test/snapshots/engine/engine_block_test/test_0011_doctype_is_optimized_to_single_text_token_e81d630999b5fe77477e60ce788a1e3d.txt @@ -2,6 +2,5 @@ source: "Engine::EngineBlockTest#test_0011_doctype is optimized to single text token" input: "{source: \"\", options: {}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0012_erb_control_structures_work_correctly_92d1893d3882087a626b1b7683e91762.txt b/test/snapshots/engine/engine_block_test/test_0012_erb_control_structures_work_correctly_92d1893d3882087a626b1b7683e91762.txt index 3d0daac37..1aa64c836 100644 --- a/test/snapshots/engine/engine_block_test/test_0012_erb_control_structures_work_correctly_92d1893d3882087a626b1b7683e91762.txt +++ b/test/snapshots/engine/engine_block_test/test_0012_erb_control_structures_work_correctly_92d1893d3882087a626b1b7683e91762.txt @@ -2,9 +2,7 @@ source: "Engine::EngineBlockTest#test_0012_erb control structures work correctly" input: "{source: \"<% 5.times do |i| %>\\n
<%= i %>
\\n<% end %>\\n\", options: {}}" --- -_buf = ::String.new; - 5.times do |i|; _buf << ' -
'.freeze; _buf << (i).to_s; _buf << '
-'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; 5.times do |i| + _buf << '
'.freeze; _buf << (i).to_s; _buf << '
+'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/engine_block_test/test_0013_erb_case_statements_compile_correctly_903b2af211dfab8347850d71f6e431e8.txt b/test/snapshots/engine/engine_block_test/test_0013_erb_case_statements_compile_correctly_903b2af211dfab8347850d71f6e431e8.txt index 0acf21356..652c3dc9f 100644 --- a/test/snapshots/engine/engine_block_test/test_0013_erb_case_statements_compile_correctly_903b2af211dfab8347850d71f6e431e8.txt +++ b/test/snapshots/engine/engine_block_test/test_0013_erb_case_statements_compile_correctly_903b2af211dfab8347850d71f6e431e8.txt @@ -2,13 +2,12 @@ source: "Engine::EngineBlockTest#test_0013_erb case statements compile correctly" input: "{source: \"<% case status %>\\n<% when :active %>\\n Active\\n<% when :pending %>\\n Pending\\n<% else %>\\n Unknown\\n<% end %>\\n\", options: {}}" --- -_buf = ::String.new; - case status; when :active; _buf << ' - Active -'.freeze; when :pending; _buf << ' - Pending -'.freeze; else; _buf << ' - Unknown -'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; case status + when :active + _buf << ' Active +'.freeze; when :pending + _buf << ' Pending +'.freeze; else + _buf << ' Unknown +'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0001_handles_no_tags_9ae679bbe8b534b33f7f0482cab09601.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0001_handles_no_tags_9ae679bbe8b534b33f7f0482cab09601.txt index 3788150e3..f7bb8cb98 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0001_handles_no_tags_9ae679bbe8b534b33f7f0482cab09601.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0001_handles_no_tags_9ae679bbe8b534b33f7f0482cab09601.txt @@ -2,7 +2,6 @@ source: "Engine::EngineErubiCompatTest#test_0001_handles no tags" input: "{source: \"a\\n\", options: {}}" --- -_buf = ::String.new; - _buf << 'a +_buf = ::String.new; _buf << 'a '.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0002_handles_basic_erb_expressions_4746f6e488bfcd3ec68007d129631394.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0002_handles_basic_erb_expressions_4746f6e488bfcd3ec68007d129631394.txt index ec2e987b8..5f61a1265 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0002_handles_basic_erb_expressions_4746f6e488bfcd3ec68007d129631394.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0002_handles_basic_erb_expressions_4746f6e488bfcd3ec68007d129631394.txt @@ -2,17 +2,16 @@ source: "Engine::EngineErubiCompatTest#test_0002_handles basic erb expressions" input: "{source: \"\\n \\n <% i = 0\\n list.each_with_index do |item, i| %>\\n \\n \\n \\n \\n <% end %>\\n \\n
<%= i+1 %><%== item %>
\\n<%== i+1 %>\\n\", options: {}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << '
- '.freeze; i = 0 - list.each_with_index do |item, i|; _buf << ' - +'.freeze; i = 0 + list.each_with_index do |item, i| + _buf << ' - '.freeze; end; _buf << ' - +'.freeze; end + _buf << '
'.freeze; _buf << (i+1).to_s; _buf << ' '.freeze; _buf << ::Herb::Engine.h((item)); _buf << '
'.freeze; _buf << ::Herb::Engine.h((i+1)); _buf << ' '.freeze; diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0003_escapes_backslashes_and_apostrophes_in_text_c1db0d9f3d8889c22cba5f33cca0a81b.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0003_escapes_backslashes_and_apostrophes_in_text_c1db0d9f3d8889c22cba5f33cca0a81b.txt index b97a1a984..c74ca758c 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0003_escapes_backslashes_and_apostrophes_in_text_c1db0d9f3d8889c22cba5f33cca0a81b.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0003_escapes_backslashes_and_apostrophes_in_text_c1db0d9f3d8889c22cba5f33cca0a81b.txt @@ -2,8 +2,7 @@ source: "Engine::EngineErubiCompatTest#test_0003_escapes backslashes and apostrophes in text" input: "{source: \"\\n ' ' \\\\\\\\ \\\\\\\\\\n\\n
\", options: {}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << '
\' \' \\\\ \\\\
'.freeze; diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0004_strips_whitespace_with_-%gt_tag_271458511492ec7e18baf77d0b7a04c3.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0004_strips_whitespace_with_-%gt_tag_271458511492ec7e18baf77d0b7a04c3.txt index 4250b3596..6712beecc 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0004_strips_whitespace_with_-%gt_tag_271458511492ec7e18baf77d0b7a04c3.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0004_strips_whitespace_with_-%gt_tag_271458511492ec7e18baf77d0b7a04c3.txt @@ -2,7 +2,7 @@ source: "Engine::EngineErubiCompatTest#test_0004_strips whitespace with -%> tag" input: "{source: \"<% a = 1 -%>\\ntext\\n\", options: {}}" --- -_buf = ::String.new; - a = 1; _buf << 'text +_buf = ::String.new; a = 1 + _buf << 'text '.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0005_handles_erb_comments_9c479c9d1b4668c4a5e3ecf9dfdc7d04.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0005_handles_erb_comments_9c479c9d1b4668c4a5e3ecf9dfdc7d04.txt index 654a3ac70..42fe36862 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0005_handles_erb_comments_9c479c9d1b4668c4a5e3ecf9dfdc7d04.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0005_handles_erb_comments_9c479c9d1b4668c4a5e3ecf9dfdc7d04.txt @@ -2,8 +2,7 @@ source: "Engine::EngineErubiCompatTest#test_0005_handles erb comments" input: "{source: \"<%# This is a comment %>\\n
Content
\\n\", options: {}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << '
Content
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0006_handles_escape_option_a7a38b365e168de54928cd4b780619ce.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0006_handles_escape_option_a7a38b365e168de54928cd4b780619ce.txt index 7403cc23f..f7f39033f 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0006_handles_escape_option_a7a38b365e168de54928cd4b780619ce.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0006_handles_escape_option_a7a38b365e168de54928cd4b780619ce.txt @@ -2,6 +2,5 @@ source: "Engine::EngineErubiCompatTest#test_0006_handles escape option" input: "{source: \"<%= content %>\", options: {escape: true}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << __herb.h((content)); +__herb = ::Herb::Engine; _buf = ::String.new; _buf << __herb.h((content)); _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0006_handles_escape_option_f439b215d233f255a2d983be50a566a6.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0006_handles_escape_option_f439b215d233f255a2d983be50a566a6.txt index a7e94eddd..7755f22f5 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0006_handles_escape_option_f439b215d233f255a2d983be50a566a6.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0006_handles_escape_option_f439b215d233f255a2d983be50a566a6.txt @@ -2,6 +2,5 @@ source: "Engine::EngineErubiCompatTest#test_0006_handles escape option" input: "{source: \"<%= content %>\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << (content).to_s; +_buf = ::String.new; _buf << (content).to_s; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0007_handles_double_equals_for_inverse_escaping_031ede7b0d3f38a431bb4e2009e597d2.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0007_handles_double_equals_for_inverse_escaping_031ede7b0d3f38a431bb4e2009e597d2.txt index ee9d30e1d..b4403b5df 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0007_handles_double_equals_for_inverse_escaping_031ede7b0d3f38a431bb4e2009e597d2.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0007_handles_double_equals_for_inverse_escaping_031ede7b0d3f38a431bb4e2009e597d2.txt @@ -2,6 +2,5 @@ source: "Engine::EngineErubiCompatTest#test_0007_handles double equals for inverse escaping" input: "{source: \"<%== content %>\", options: {escape: true}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << (content).to_s; +__herb = ::Herb::Engine; _buf = ::String.new; _buf << (content).to_s; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0007_handles_double_equals_for_inverse_escaping_7d6fcd9b42b7c23b832eae52e36033ef.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0007_handles_double_equals_for_inverse_escaping_7d6fcd9b42b7c23b832eae52e36033ef.txt index 56cc12bae..f8f064738 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0007_handles_double_equals_for_inverse_escaping_7d6fcd9b42b7c23b832eae52e36033ef.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0007_handles_double_equals_for_inverse_escaping_7d6fcd9b42b7c23b832eae52e36033ef.txt @@ -2,6 +2,5 @@ source: "Engine::EngineErubiCompatTest#test_0007_handles double equals for inverse escaping" input: "{source: \"<%== content %>\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << ::Herb::Engine.h((content)); +_buf = ::String.new; _buf << ::Herb::Engine.h((content)); _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0008_handles_custom_bufvar_4b12581137e52226597b0aa84fec1148.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0008_handles_custom_bufvar_4b12581137e52226597b0aa84fec1148.txt index a401c5fe6..2e12bcb52 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0008_handles_custom_bufvar_4b12581137e52226597b0aa84fec1148.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0008_handles_custom_bufvar_4b12581137e52226597b0aa84fec1148.txt @@ -2,6 +2,5 @@ source: "Engine::EngineErubiCompatTest#test_0008_handles custom bufvar" input: "{source: \"
Test
\", options: {bufvar: \"@output\"}}" --- -@output = ::String.new; - @output << '
Test
'.freeze; +@output = ::String.new; @output << '
Test
'.freeze; @output.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0009_handles_freeze_option_c7cfe845c307b290283374cda0e6b3bd.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0009_handles_freeze_option_c7cfe845c307b290283374cda0e6b3bd.txt index 4c1fa9a92..b001df5eb 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0009_handles_freeze_option_c7cfe845c307b290283374cda0e6b3bd.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0009_handles_freeze_option_c7cfe845c307b290283374cda0e6b3bd.txt @@ -3,6 +3,5 @@ source: "Engine::EngineErubiCompatTest#test_0009_handles freeze option" input: "{source: \"
Static content
\", options: {freeze: true}}" --- # frozen_string_literal: true -_buf = ::String.new; - _buf << '
Static content
'.freeze; +_buf = ::String.new; _buf << '
Static content
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0010_handles_freeze_template_literals_option_848883dc35cf359944935b46efa0d2a1.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0010_handles_freeze_template_literals_option_848883dc35cf359944935b46efa0d2a1.txt index 6c451c7be..f3dfbeeb0 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0010_handles_freeze_template_literals_option_848883dc35cf359944935b46efa0d2a1.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0010_handles_freeze_template_literals_option_848883dc35cf359944935b46efa0d2a1.txt @@ -2,6 +2,5 @@ source: "Engine::EngineErubiCompatTest#test_0010_handles freeze_template_literals option" input: "{source: \"
Content
\", options: {}}" --- -_buf = ::String.new; - _buf << '
Content
'.freeze; +_buf = ::String.new; _buf << '
Content
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0010_handles_freeze_template_literals_option_ae490373e053cdc4f8e3effa5267d81e.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0010_handles_freeze_template_literals_option_ae490373e053cdc4f8e3effa5267d81e.txt index c952fbfb0..489e12bc8 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0010_handles_freeze_template_literals_option_ae490373e053cdc4f8e3effa5267d81e.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0010_handles_freeze_template_literals_option_ae490373e053cdc4f8e3effa5267d81e.txt @@ -2,6 +2,5 @@ source: "Engine::EngineErubiCompatTest#test_0010_handles freeze_template_literals option" input: "{source: \"
Content
\", options: {freeze_template_literals: false}}" --- -_buf = ::String.new; - _buf << '
Content
'; +_buf = ::String.new; _buf << '
Content
'; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0011_handles_custom_preamble_and_postamble_3b55a12762518f8786870b322ca30296.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0011_handles_custom_preamble_and_postamble_3b55a12762518f8786870b322ca30296.txt index 633034d68..9d7ec2334 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0011_handles_custom_preamble_and_postamble_3b55a12762518f8786870b322ca30296.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0011_handles_custom_preamble_and_postamble_3b55a12762518f8786870b322ca30296.txt @@ -2,6 +2,5 @@ source: "Engine::EngineErubiCompatTest#test_0011_handles custom preamble and postamble" input: "{source: \"
Test
\", options: {preamble: \"@buf = []\", postamble: \"@buf.join\"}}" --- -@buf = [] - _buf << '
Test
'.freeze; +@buf = [] _buf << '
Test
'.freeze; @buf.join \ No newline at end of file diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0012_handles_ensure_option_5087762b1aa5a6cb20238d3e8292b14f.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0012_handles_ensure_option_5087762b1aa5a6cb20238d3e8292b14f.txt index ece6e51ab..9822476d4 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0012_handles_ensure_option_5087762b1aa5a6cb20238d3e8292b14f.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0012_handles_ensure_option_5087762b1aa5a6cb20238d3e8292b14f.txt @@ -2,8 +2,7 @@ source: "Engine::EngineErubiCompatTest#test_0012_handles ensure option" input: "{source: \"
Test
\", options: {ensure: true}}" --- -begin; __original_outvar = _buf if defined?(_buf); _buf = ::String.new; - _buf << '
Test
'.freeze; +begin; __original_outvar = _buf if defined?(_buf); _buf = ::String.new; _buf << '
Test
'.freeze; _buf.to_s ; ensure _buf = __original_outvar diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0013_handles_custom_escapefunc_b132833b75887924426e4f08e89a7a3b.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0013_handles_custom_escapefunc_b132833b75887924426e4f08e89a7a3b.txt index cbb00e352..93ebb9693 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0013_handles_custom_escapefunc_b132833b75887924426e4f08e89a7a3b.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0013_handles_custom_escapefunc_b132833b75887924426e4f08e89a7a3b.txt @@ -2,6 +2,5 @@ source: "Engine::EngineErubiCompatTest#test_0013_handles custom escapefunc" input: "{source: \"<%== content %>\", options: {escape: false, escapefunc: \"CGI.escapeHTML\"}}" --- -_buf = ::String.new; - _buf << CGI.escapeHTML((content)); +_buf = ::String.new; _buf << CGI.escapeHTML((content)); _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0014_handles_chain_appends_option_7c6e88add003e4e2d3e5321121035b4d.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0014_handles_chain_appends_option_7c6e88add003e4e2d3e5321121035b4d.txt index d58a0e99a..faaa41cf0 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0014_handles_chain_appends_option_7c6e88add003e4e2d3e5321121035b4d.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0014_handles_chain_appends_option_7c6e88add003e4e2d3e5321121035b4d.txt @@ -2,8 +2,7 @@ source: "Engine::EngineErubiCompatTest#test_0014_handles chain_appends option" input: "{source: \"<%= a %>\\n<%= b %>\\n\", options: {chain_appends: false}}" --- -_buf = ::String.new; - _buf << (a).to_s; _buf << ' +_buf = ::String.new; _buf << (a).to_s; _buf << ' '.freeze; _buf << (b).to_s; _buf << ' '.freeze; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0014_handles_chain_appends_option_d91d14c6c78ca542efb889aef824b39f.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0014_handles_chain_appends_option_d91d14c6c78ca542efb889aef824b39f.txt index f20be6836..d4751cfd4 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0014_handles_chain_appends_option_d91d14c6c78ca542efb889aef824b39f.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0014_handles_chain_appends_option_d91d14c6c78ca542efb889aef824b39f.txt @@ -2,8 +2,7 @@ source: "Engine::EngineErubiCompatTest#test_0014_handles chain_appends option" input: "{source: \"<%= a %>\\n<%= b %>\\n\", options: {chain_appends: true}}" --- -_buf = ::String.new; -; _buf << (a).to_s << ' +_buf = ::String.new;; _buf << (a).to_s << ' '.freeze << (b).to_s << ' '.freeze ; _buf.to_s diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0015_handles_multiple_erb_constructs_in_complex_template_8033045d7c8ec7030c37a69705c95b59.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0015_handles_multiple_erb_constructs_in_complex_template_8033045d7c8ec7030c37a69705c95b59.txt index e4e303fc2..16925689b 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0015_handles_multiple_erb_constructs_in_complex_template_8033045d7c8ec7030c37a69705c95b59.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0015_handles_multiple_erb_constructs_in_complex_template_8033045d7c8ec7030c37a69705c95b59.txt @@ -2,25 +2,24 @@ source: "Engine::EngineErubiCompatTest#test_0015_handles multiple erb constructs in complex template" input: "{source: \"\\n\\n\\n <%= @title %>\\n\\n\\n <% if @user %>\\n

Welcome <%= @user.name %>!

\\n <% @user.posts.each do |post| %>\\n
\\n

<%== post.title %>

\\n
<%= post.content %>
\\n
\\n <% end %>\\n <% else %>\\n

Please log in

\\n <% end %>\\n <%# This comment should not appear %>\\n\\n\\n\", options: {}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << ' '.freeze; _buf << (@title).to_s; _buf << ' - '.freeze; if @user; _buf << ' -

Welcome '.freeze; _buf << (@user.name).to_s; _buf << '!

- '.freeze; @user.posts.each do |post|; _buf << ' -
+'.freeze; if @user + _buf << '

Welcome '.freeze; _buf << (@user.name).to_s; _buf << '!

+'.freeze; @user.posts.each do |post| + _buf << '

'.freeze; _buf << ::Herb::Engine.h((post.title)); _buf << '

'.freeze; _buf << (post.content).to_s; _buf << '
- '.freeze; end; _buf << ' - '.freeze; else; _buf << ' -

Please log in

- '.freeze; end; _buf << ' - +'.freeze; end + else + _buf << '

Please log in

+'.freeze; end + _buf << ' '.freeze; diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0016_handles_void_elements_correctly_ec8e16b071f1512af4c11c6f5e83a83e.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0016_handles_void_elements_correctly_ec8e16b071f1512af4c11c6f5e83a83e.txt index de0d50bbd..1a2ca2f78 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0016_handles_void_elements_correctly_ec8e16b071f1512af4c11c6f5e83a83e.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0016_handles_void_elements_correctly_ec8e16b071f1512af4c11c6f5e83a83e.txt @@ -2,8 +2,7 @@ source: "Engine::EngineErubiCompatTest#test_0016_handles void elements correctly" input: "{source: \"\\\"Photo\\\"\\n
\\n\\\">\\n\", options: {}}" --- -_buf = ::String.new; - _buf << 'Photo +_buf = ::String.new; _buf << 'Photo
'.freeze; diff --git a/test/snapshots/engine/engine_erubi_compat_test/test_0017_handles_CDATA_sections_9b2c1232f3a08d85651530a3a053bd1d.txt b/test/snapshots/engine/engine_erubi_compat_test/test_0017_handles_CDATA_sections_9b2c1232f3a08d85651530a3a053bd1d.txt index 1cd9d4279..30ac0ccda 100644 --- a/test/snapshots/engine/engine_erubi_compat_test/test_0017_handles_CDATA_sections_9b2c1232f3a08d85651530a3a053bd1d.txt +++ b/test/snapshots/engine/engine_erubi_compat_test/test_0017_handles_CDATA_sections_9b2c1232f3a08d85651530a3a053bd1d.txt @@ -2,8 +2,7 @@ source: "Engine::EngineErubiCompatTest#test_0017_handles CDATA sections" input: "{source: \"\\n\", options: {}}" --- -_buf = ::String.new; - _buf << '\", options: {}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/javascript/test_0002_escape_true_b20f9d8b8dcf7e533b68a6db0194bc75.txt b/test/snapshots/engine/escape_test/javascript/test_0002_escape_true_b20f9d8b8dcf7e533b68a6db0194bc75.txt index 8dd383728..ad2fe1a7e 100644 --- a/test/snapshots/engine/escape_test/javascript/test_0002_escape_true_b20f9d8b8dcf7e533b68a6db0194bc75.txt +++ b/test/snapshots/engine/escape_test/javascript/test_0002_escape_true_b20f9d8b8dcf7e533b68a6db0194bc75.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::javascript#test_0002_escape: true" input: "{source: \"\", options: {escape: true}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << ''.freeze; +__herb = ::Herb::Engine; _buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/javascript/test_0003_custom_jsfunc_fff096d3faee3e5c8c1b1f5d09f407d1.txt b/test/snapshots/engine/escape_test/javascript/test_0003_custom_jsfunc_fff096d3faee3e5c8c1b1f5d09f407d1.txt index 3591e5fd4..69a9da985 100644 --- a/test/snapshots/engine/escape_test/javascript/test_0003_custom_jsfunc_fff096d3faee3e5c8c1b1f5d09f407d1.txt +++ b/test/snapshots/engine/escape_test/javascript/test_0003_custom_jsfunc_fff096d3faee3e5c8c1b1f5d09f407d1.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::javascript#test_0003_custom jsfunc" input: "{source: \"\", options: {jsfunc: \"CustomEscape.js\"}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/javascript/test_0004_empty_jsfunc_33b8e30f7bf28e4f9dfc23d89e187438.txt b/test/snapshots/engine/escape_test/javascript/test_0004_empty_jsfunc_33b8e30f7bf28e4f9dfc23d89e187438.txt index 6030f0f83..d6e25e652 100644 --- a/test/snapshots/engine/escape_test/javascript/test_0004_empty_jsfunc_33b8e30f7bf28e4f9dfc23d89e187438.txt +++ b/test/snapshots/engine/escape_test/javascript/test_0004_empty_jsfunc_33b8e30f7bf28e4f9dfc23d89e187438.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::javascript#test_0004_empty jsfunc" input: "{source: \"\", options: {jsfunc: \"\"}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/javascript/test_0005_escape_true_and_custom_jsfunc_efcb50766c5a8f17b97cfd5ad4ca67cd.txt b/test/snapshots/engine/escape_test/javascript/test_0005_escape_true_and_custom_jsfunc_efcb50766c5a8f17b97cfd5ad4ca67cd.txt index d8ace880b..a6a1086d1 100644 --- a/test/snapshots/engine/escape_test/javascript/test_0005_escape_true_and_custom_jsfunc_efcb50766c5a8f17b97cfd5ad4ca67cd.txt +++ b/test/snapshots/engine/escape_test/javascript/test_0005_escape_true_and_custom_jsfunc_efcb50766c5a8f17b97cfd5ad4ca67cd.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::javascript#test_0005_escape: true and custom jsfunc" input: "{source: \"\", options: {escape: true, jsfunc: \"CustomEscape.js\"}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << ''.freeze; +__herb = ::Herb::Engine; _buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/javascript/test_0006_escape_true_and_empty_jsfunc_96ece398c40750f59650d0c35f953dd9.txt b/test/snapshots/engine/escape_test/javascript/test_0006_escape_true_and_empty_jsfunc_96ece398c40750f59650d0c35f953dd9.txt index 7bdf9d7ea..730cdc8a0 100644 --- a/test/snapshots/engine/escape_test/javascript/test_0006_escape_true_and_empty_jsfunc_96ece398c40750f59650d0c35f953dd9.txt +++ b/test/snapshots/engine/escape_test/javascript/test_0006_escape_true_and_empty_jsfunc_96ece398c40750f59650d0c35f953dd9.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::javascript#test_0006_escape: true and empty jsfunc" input: "{source: \"\", options: {escape: true, jsfunc: \"\"}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << ''.freeze; +__herb = ::Herb::Engine; _buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/javascript/test_0007_escape_false_and_custom_jsfunc_f436b9a75e95db20869db3ea9fd57766.txt b/test/snapshots/engine/escape_test/javascript/test_0007_escape_false_and_custom_jsfunc_f436b9a75e95db20869db3ea9fd57766.txt index 5833cf0b6..9c2e0163c 100644 --- a/test/snapshots/engine/escape_test/javascript/test_0007_escape_false_and_custom_jsfunc_f436b9a75e95db20869db3ea9fd57766.txt +++ b/test/snapshots/engine/escape_test/javascript/test_0007_escape_false_and_custom_jsfunc_f436b9a75e95db20869db3ea9fd57766.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::javascript#test_0007_escape: false and custom jsfunc" input: "{source: \"\", options: {escape: false, jsfunc: \"CustomEscape.js\"}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/javascript/test_0008_escape_false_and_empty_jsfunc_3d49d1a8bb960fe85c74d4deb4d3107f.txt b/test/snapshots/engine/escape_test/javascript/test_0008_escape_false_and_empty_jsfunc_3d49d1a8bb960fe85c74d4deb4d3107f.txt index e3bf43a6a..91ee670db 100644 --- a/test/snapshots/engine/escape_test/javascript/test_0008_escape_false_and_empty_jsfunc_3d49d1a8bb960fe85c74d4deb4d3107f.txt +++ b/test/snapshots/engine/escape_test/javascript/test_0008_escape_false_and_empty_jsfunc_3d49d1a8bb960fe85c74d4deb4d3107f.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::javascript#test_0008_escape: false and empty jsfunc" input: "{source: \"\", options: {escape: false, jsfunc: \"\"}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/style/test_0001_default_b2440242cdba618522e76914ac63a054.txt b/test/snapshots/engine/escape_test/style/test_0001_default_b2440242cdba618522e76914ac63a054.txt index 3a43c25c7..9a2b8a18e 100644 --- a/test/snapshots/engine/escape_test/style/test_0001_default_b2440242cdba618522e76914ac63a054.txt +++ b/test/snapshots/engine/escape_test/style/test_0001_default_b2440242cdba618522e76914ac63a054.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::style#test_0001_default" input: "{source: \"\", options: {}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/style/test_0002_escape_true_4781fa0cc6abdaa0769dba2eb345e4cd.txt b/test/snapshots/engine/escape_test/style/test_0002_escape_true_4781fa0cc6abdaa0769dba2eb345e4cd.txt index ac59c4f4b..65cc21cfd 100644 --- a/test/snapshots/engine/escape_test/style/test_0002_escape_true_4781fa0cc6abdaa0769dba2eb345e4cd.txt +++ b/test/snapshots/engine/escape_test/style/test_0002_escape_true_4781fa0cc6abdaa0769dba2eb345e4cd.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::style#test_0002_escape: true" input: "{source: \"\", options: {escape: true}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << ''.freeze; +__herb = ::Herb::Engine; _buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/style/test_0003_custom_cssfunc_bbd4d2d294779b5762d02b2e1c07fb11.txt b/test/snapshots/engine/escape_test/style/test_0003_custom_cssfunc_bbd4d2d294779b5762d02b2e1c07fb11.txt index dedccd360..34cc861ec 100644 --- a/test/snapshots/engine/escape_test/style/test_0003_custom_cssfunc_bbd4d2d294779b5762d02b2e1c07fb11.txt +++ b/test/snapshots/engine/escape_test/style/test_0003_custom_cssfunc_bbd4d2d294779b5762d02b2e1c07fb11.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::style#test_0003_custom cssfunc" input: "{source: \"\", options: {cssfunc: \"CustomEscape.css\"}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/style/test_0004_empty_cssfunc_986ecd0589393eb937ceee2aa419f49e.txt b/test/snapshots/engine/escape_test/style/test_0004_empty_cssfunc_986ecd0589393eb937ceee2aa419f49e.txt index 29f970f3a..f5eeb3ac4 100644 --- a/test/snapshots/engine/escape_test/style/test_0004_empty_cssfunc_986ecd0589393eb937ceee2aa419f49e.txt +++ b/test/snapshots/engine/escape_test/style/test_0004_empty_cssfunc_986ecd0589393eb937ceee2aa419f49e.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::style#test_0004_empty cssfunc" input: "{source: \"\", options: {cssfunc: \"\"}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/style/test_0005_escape_true_and_custom_cssfunc_cd5298d4aac80c862e718692bdf83eab.txt b/test/snapshots/engine/escape_test/style/test_0005_escape_true_and_custom_cssfunc_cd5298d4aac80c862e718692bdf83eab.txt index fdadff39b..32b971736 100644 --- a/test/snapshots/engine/escape_test/style/test_0005_escape_true_and_custom_cssfunc_cd5298d4aac80c862e718692bdf83eab.txt +++ b/test/snapshots/engine/escape_test/style/test_0005_escape_true_and_custom_cssfunc_cd5298d4aac80c862e718692bdf83eab.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::style#test_0005_escape: true and custom cssfunc" input: "{source: \"\", options: {escape: true, cssfunc: \"CustomEscape.css\"}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << ''.freeze; +__herb = ::Herb::Engine; _buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/style/test_0006_escape_true_and_empty_cssfunc_4d1ec0837eb25b77cd79886db2c4dee6.txt b/test/snapshots/engine/escape_test/style/test_0006_escape_true_and_empty_cssfunc_4d1ec0837eb25b77cd79886db2c4dee6.txt index 93c99caa8..f8598fcb5 100644 --- a/test/snapshots/engine/escape_test/style/test_0006_escape_true_and_empty_cssfunc_4d1ec0837eb25b77cd79886db2c4dee6.txt +++ b/test/snapshots/engine/escape_test/style/test_0006_escape_true_and_empty_cssfunc_4d1ec0837eb25b77cd79886db2c4dee6.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::style#test_0006_escape: true and empty cssfunc" input: "{source: \"\", options: {escape: true, cssfunc: \"\"}}" --- -__herb = ::Herb::Engine; _buf = ::String.new; - _buf << ''.freeze; +__herb = ::Herb::Engine; _buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/style/test_0007_escape_false_and_custom_cssfunc_28db6ce107bc81f050f3de9a654f8fa5.txt b/test/snapshots/engine/escape_test/style/test_0007_escape_false_and_custom_cssfunc_28db6ce107bc81f050f3de9a654f8fa5.txt index b123a5012..d0f0f8344 100644 --- a/test/snapshots/engine/escape_test/style/test_0007_escape_false_and_custom_cssfunc_28db6ce107bc81f050f3de9a654f8fa5.txt +++ b/test/snapshots/engine/escape_test/style/test_0007_escape_false_and_custom_cssfunc_28db6ce107bc81f050f3de9a654f8fa5.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::style#test_0007_escape: false and custom cssfunc" input: "{source: \"\", options: {escape: false, cssfunc: \"CustomEscape.css\"}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/escape_test/style/test_0008_escape_false_and_empty_cssfunc_3cb7a8609a8656ee321b953d5a5132f4.txt b/test/snapshots/engine/escape_test/style/test_0008_escape_false_and_empty_cssfunc_3cb7a8609a8656ee321b953d5a5132f4.txt index 9ddffdf7c..6a221f596 100644 --- a/test/snapshots/engine/escape_test/style/test_0008_escape_false_and_empty_cssfunc_3cb7a8609a8656ee321b953d5a5132f4.txt +++ b/test/snapshots/engine/escape_test/style/test_0008_escape_false_and_empty_cssfunc_3cb7a8609a8656ee321b953d5a5132f4.txt @@ -2,6 +2,5 @@ source: "Engine::EscapeTest::style#test_0008_escape: false and empty cssfunc" input: "{source: \"\", options: {escape: false, cssfunc: \"\"}}" --- -_buf = ::String.new; - _buf << ''.freeze; +_buf = ::String.new; _buf << ''.freeze; _buf.to_s diff --git a/test/snapshots/engine/evaluation_test/test_0005_conditional_rendering_true_f476d94ad451540a483556ee84873425.txt b/test/snapshots/engine/evaluation_test/test_0005_conditional_rendering_true_f476d94ad451540a483556ee84873425.txt index 4d98d69fc..ee6218d6c 100644 --- a/test/snapshots/engine/evaluation_test/test_0005_conditional_rendering_true_f476d94ad451540a483556ee84873425.txt +++ b/test/snapshots/engine/evaluation_test/test_0005_conditional_rendering_true_f476d94ad451540a483556ee84873425.txt @@ -3,7 +3,5 @@ source: "Engine::EvaluationTest#test_0005_conditional rendering true" input: "{source: \"
\\n <% if show_message? %>\\n

Message is shown

\\n <% else %>\\n

Message is hidden

\\n <% end %>\\n
\\n\", locals: {show_message?: true}, options: {escape: false}}" ---
-

Message is shown

-
diff --git a/test/snapshots/engine/evaluation_test/test_0006_conditional_rendering_false_cc1fa20e0a32190d88a0227eb61a12a9.txt b/test/snapshots/engine/evaluation_test/test_0006_conditional_rendering_false_cc1fa20e0a32190d88a0227eb61a12a9.txt index 06beb2d1f..a56eaa1b4 100644 --- a/test/snapshots/engine/evaluation_test/test_0006_conditional_rendering_false_cc1fa20e0a32190d88a0227eb61a12a9.txt +++ b/test/snapshots/engine/evaluation_test/test_0006_conditional_rendering_false_cc1fa20e0a32190d88a0227eb61a12a9.txt @@ -3,7 +3,5 @@ source: "Engine::EvaluationTest#test_0006_conditional rendering false" input: "{source: \"
\\n <% if show_message? %>\\n

Message is shown

\\n <% else %>\\n

Message is hidden

\\n <% end %>\\n
\\n\", locals: {show_message?: false}, options: {escape: false}}" ---
-

Message is hidden

-
diff --git a/test/snapshots/engine/evaluation_test/test_0007_loop_rendering_6e40ec8a557eaa730717359ad0e81955.txt b/test/snapshots/engine/evaluation_test/test_0007_loop_rendering_6e40ec8a557eaa730717359ad0e81955.txt index 2b6cc5897..ef9dcf336 100644 --- a/test/snapshots/engine/evaluation_test/test_0007_loop_rendering_6e40ec8a557eaa730717359ad0e81955.txt +++ b/test/snapshots/engine/evaluation_test/test_0007_loop_rendering_6e40ec8a557eaa730717359ad0e81955.txt @@ -3,11 +3,7 @@ source: "Engine::EvaluationTest#test_0007_loop rendering" input: "{source: \"
    \\n <% items.each do |item| %>\\n
  • <%= item %>
  • \\n <% end %>\\n
\\n\", locals: {items: [\"apple\", \"banana\", \"cherry\"]}, options: {escape: false}}" ---
    -
  • apple
  • -
  • banana
  • -
  • cherry
  • -
diff --git a/test/snapshots/engine/evaluation_test/test_0008_nested_loops_41457e8139a808914d288744c4e0c532.txt b/test/snapshots/engine/evaluation_test/test_0008_nested_loops_41457e8139a808914d288744c4e0c532.txt index e6b1ed0c7..6831dfd3c 100644 --- a/test/snapshots/engine/evaluation_test/test_0008_nested_loops_41457e8139a808914d288744c4e0c532.txt +++ b/test/snapshots/engine/evaluation_test/test_0008_nested_loops_41457e8139a808914d288744c4e0c532.txt @@ -3,23 +3,14 @@ source: "Engine::EvaluationTest#test_0008_nested loops" input: "{source: \"
\\n <% categories.each do |category| %>\\n

<%= category[:name] %>

\\n
    \\n <% category[:items].each do |item| %>\\n
  • <%= item %>
  • \\n <% end %>\\n
\\n <% end %>\\n
\\n\", locals: {categories: [{name: \"Fruits\", items: [\"apple\", \"banana\"]}, {name: \"Colors\", items: [\"red\", \"blue\"]}]}, options: {escape: false}}" ---
-

Fruits

    -
  • apple
  • -
  • banana
  • -
-

Colors

    -
  • red
  • -
  • blue
  • -
-
diff --git a/test/snapshots/engine/evaluation_test/test_0009_complex_expressions_4a8e4604acd824ebd86dd77c316ced30.txt b/test/snapshots/engine/evaluation_test/test_0009_complex_expressions_4a8e4604acd824ebd86dd77c316ced30.txt index d2850374d..d1a1f2506 100644 --- a/test/snapshots/engine/evaluation_test/test_0009_complex_expressions_4a8e4604acd824ebd86dd77c316ced30.txt +++ b/test/snapshots/engine/evaluation_test/test_0009_complex_expressions_4a8e4604acd824ebd86dd77c316ced30.txt @@ -5,7 +5,5 @@ input: "{source: \"
\\\" data-active=\\\"<%= us

JOHN DOE

Score: 150

- Excellent! -
diff --git a/test/snapshots/engine/evaluation_test/test_0011_unless_conditional_false_c4f4ef6359c9b399bbe059b270d0388f.txt b/test/snapshots/engine/evaluation_test/test_0011_unless_conditional_false_c4f4ef6359c9b399bbe059b270d0388f.txt index a3853f33f..a1697e5e1 100644 --- a/test/snapshots/engine/evaluation_test/test_0011_unless_conditional_false_c4f4ef6359c9b399bbe059b270d0388f.txt +++ b/test/snapshots/engine/evaluation_test/test_0011_unless_conditional_false_c4f4ef6359c9b399bbe059b270d0388f.txt @@ -2,6 +2,4 @@ source: "Engine::EvaluationTest#test_0011_unless conditional false" input: "{source: \"<% unless hide_content? %>\\n

Content is visible

\\n<% else %>\\n

Content is hidden

\\n<% end %>\\n\", locals: {hide_content?: false}, options: {escape: false}}" --- -

Content is visible

- diff --git a/test/snapshots/engine/evaluation_test/test_0012_unless_conditional_true_62ddfd676314329facbb84fd7db1974c.txt b/test/snapshots/engine/evaluation_test/test_0012_unless_conditional_true_62ddfd676314329facbb84fd7db1974c.txt index b918db834..41243e2a7 100644 --- a/test/snapshots/engine/evaluation_test/test_0012_unless_conditional_true_62ddfd676314329facbb84fd7db1974c.txt +++ b/test/snapshots/engine/evaluation_test/test_0012_unless_conditional_true_62ddfd676314329facbb84fd7db1974c.txt @@ -2,6 +2,4 @@ source: "Engine::EvaluationTest#test_0012_unless conditional true" input: "{source: \"<% unless hide_content? %>\\n

Content is visible

\\n<% else %>\\n

Content is hidden

\\n<% end %>\\n\", locals: {hide_content?: true}, options: {escape: false}}" --- -

Content is hidden

- diff --git a/test/snapshots/engine/evaluation_test/test_0013_case_statement_pending_8fd46cbbe67a0d2871dee4eca5f8e38f.txt b/test/snapshots/engine/evaluation_test/test_0013_case_statement_pending_8fd46cbbe67a0d2871dee4eca5f8e38f.txt index 78bae349f..fa0357d50 100644 --- a/test/snapshots/engine/evaluation_test/test_0013_case_statement_pending_8fd46cbbe67a0d2871dee4eca5f8e38f.txt +++ b/test/snapshots/engine/evaluation_test/test_0013_case_statement_pending_8fd46cbbe67a0d2871dee4eca5f8e38f.txt @@ -3,7 +3,5 @@ source: "Engine::EvaluationTest#test_0013_case statement pending" input: "{source: \"
\\n <% case status %>\\n <% when \\\"pending\\\" %>\\n Pending\\n <% when \\\"approved\\\" %>\\n Approved\\n <% when \\\"rejected\\\" %>\\n Rejected\\n <% else %>\\n Unknown\\n <% end %>\\n
\\n\", locals: {status: \"pending\"}, options: {escape: false}}" ---
- Pending -
diff --git a/test/snapshots/engine/evaluation_test/test_0014_case_statement_approved_989341ea9ef14353decf0f2697a3b605.txt b/test/snapshots/engine/evaluation_test/test_0014_case_statement_approved_989341ea9ef14353decf0f2697a3b605.txt index 0555820d1..f15139993 100644 --- a/test/snapshots/engine/evaluation_test/test_0014_case_statement_approved_989341ea9ef14353decf0f2697a3b605.txt +++ b/test/snapshots/engine/evaluation_test/test_0014_case_statement_approved_989341ea9ef14353decf0f2697a3b605.txt @@ -3,7 +3,5 @@ source: "Engine::EvaluationTest#test_0014_case statement approved" input: "{source: \"
\\n <% case status %>\\n <% when \\\"pending\\\" %>\\n Pending\\n <% when \\\"approved\\\" %>\\n Approved\\n <% when \\\"rejected\\\" %>\\n Rejected\\n <% else %>\\n Unknown\\n <% end %>\\n
\\n\", locals: {status: \"approved\"}, options: {escape: false}}" ---
- Approved -
diff --git a/test/snapshots/engine/evaluation_test/test_0015_case_statement_unknown_8bdf6d6267e185f6eaaa261aed0851fd.txt b/test/snapshots/engine/evaluation_test/test_0015_case_statement_unknown_8bdf6d6267e185f6eaaa261aed0851fd.txt index 26e99bbc1..942d101ba 100644 --- a/test/snapshots/engine/evaluation_test/test_0015_case_statement_unknown_8bdf6d6267e185f6eaaa261aed0851fd.txt +++ b/test/snapshots/engine/evaluation_test/test_0015_case_statement_unknown_8bdf6d6267e185f6eaaa261aed0851fd.txt @@ -3,7 +3,5 @@ source: "Engine::EvaluationTest#test_0015_case statement unknown" input: "{source: \"
\\n <% case status %>\\n <% when \\\"pending\\\" %>\\n Pending\\n <% when \\\"approved\\\" %>\\n Approved\\n <% when \\\"rejected\\\" %>\\n Rejected\\n <% else %>\\n Unknown\\n <% end %>\\n
\\n\", locals: {status: \"invalid\"}, options: {escape: false}}" ---
- Unknown -
diff --git a/test/snapshots/engine/evaluation_test/test_0017_whitespace_handling_8efdae73f991e421da3048f196d4f1e2.txt b/test/snapshots/engine/evaluation_test/test_0017_whitespace_handling_8efdae73f991e421da3048f196d4f1e2.txt index 5f25cb746..d93bc51eb 100644 --- a/test/snapshots/engine/evaluation_test/test_0017_whitespace_handling_8efdae73f991e421da3048f196d4f1e2.txt +++ b/test/snapshots/engine/evaluation_test/test_0017_whitespace_handling_8efdae73f991e421da3048f196d4f1e2.txt @@ -3,9 +3,6 @@ source: "Engine::EvaluationTest#test_0017_whitespace handling" input: "{source: \"
\\n <% items.each do |item| -%>\\n <%= item %>\\n <% end -%>\\n
\\n\", locals: {items: [\"a\", \"b\"]}, options: {escape: false}}" ---
- a - b -
diff --git a/test/snapshots/engine/evaluation_test/test_0022_complex_real_world_example_77e6fc93cd860e93537231583cd9cf3f.txt b/test/snapshots/engine/evaluation_test/test_0022_complex_real_world_example_77e6fc93cd860e93537231583cd9cf3f.txt index 2bd9ccd90..7ba3d9cc2 100644 --- a/test/snapshots/engine/evaluation_test/test_0022_complex_real_world_example_77e6fc93cd860e93537231583cd9cf3f.txt +++ b/test/snapshots/engine/evaluation_test/test_0022_complex_real_world_example_77e6fc93cd860e93537231583cd9cf3f.txt @@ -12,32 +12,24 @@ input: "{source: \"\\n\\n \\n <%= page_tit <header> <h1>My Awesome Blog</h1> <nav> - <a href="/" class="active"> Home </a> - <a href="/about" class=""> About </a> - <a href="/contact" class=""> Contact </a> - </nav> </header> <main> - <div class="alert alert-success"> Welcome! </div> - <section class="content"> - - <article class="post" data-index="0"> <h2>First Post</h2> <p class="meta"> @@ -46,17 +38,11 @@ input: "{source: \"<!DOCTYPE html>\\n<html>\\n <head>\\n <title><%= page_tit <div class="content"> This is the first post excerpt. </div> - <div class="tags"> - <span class="tag">ruby</span> - <span class="tag">programming</span> - </div> - </article> - <article class="post" data-index="1"> <h2>Second Post</h2> <p class="meta"> @@ -65,18 +51,11 @@ input: "{source: \"<!DOCTYPE html>\\n<html>\\n <head>\\n <title><%= page_tit <div class="content"> This is the second post excerpt. </div> - <div class="tags"> - <span class="tag">html</span> - <span class="tag">css</span> - </div> - </article> - - </section> </main> diff --git a/test/snapshots/engine/evaluation_test/test_0023_utf8_handling_1a606908d02705253fec4859259e69e2.txt b/test/snapshots/engine/evaluation_test/test_0023_utf8_handling_1a606908d02705253fec4859259e69e2.txt index 4817a040c..2657f12cb 100644 --- a/test/snapshots/engine/evaluation_test/test_0023_utf8_handling_1a606908d02705253fec4859259e69e2.txt +++ b/test/snapshots/engine/evaluation_test/test_0023_utf8_handling_1a606908d02705253fec4859259e69e2.txt @@ -5,5 +5,4 @@ input: "{source: \"Sitename • Title\\n\\n<% @title = \\\"Home\\\" %>\\n\\n<tit Sitename • Title - <title>Home • Sitename diff --git a/test/snapshots/engine/evaluation_test/test_0026_inline_ruby_comment_with_newline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt b/test/snapshots/engine/evaluation_test/test_0026_inline_ruby_comment_with_newline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt index cdb098528..6bd8983c6 100644 --- a/test/snapshots/engine/evaluation_test/test_0026_inline_ruby_comment_with_newline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt +++ b/test/snapshots/engine/evaluation_test/test_0026_inline_ruby_comment_with_newline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt @@ -2,4 +2,3 @@ source: "Engine::EvaluationTest#test_0026_inline ruby comment with newline" input: "{source: \"<% if true %><% # Comment here %>\\n<% end %>\", locals: {}, options: {escape: false}}" --- - diff --git a/test/snapshots/engine/evaluation_test/test_0029_inline_ruby_comment_with_spaces_c05d8f81793b59bea0ce93cf959bcfbe.txt b/test/snapshots/engine/evaluation_test/test_0029_inline_ruby_comment_with_spaces_c05d8f81793b59bea0ce93cf959bcfbe.txt index 296828987..d015c0503 100644 --- a/test/snapshots/engine/evaluation_test/test_0029_inline_ruby_comment_with_spaces_c05d8f81793b59bea0ce93cf959bcfbe.txt +++ b/test/snapshots/engine/evaluation_test/test_0029_inline_ruby_comment_with_spaces_c05d8f81793b59bea0ce93cf959bcfbe.txt @@ -2,4 +2,4 @@ source: "Engine::EvaluationTest#test_0029_inline ruby comment with spaces" input: "{source: \"<% # Comment %> <% code = \\\"test\\\" %><%= code %>\", locals: {}, options: {escape: false}}" --- - test \ No newline at end of file +test \ No newline at end of file diff --git a/test/snapshots/engine/evaluation_test/test_0030_inline_ruby_comment_multiline_d65c4c66f63611e90c0ea96b74af1ce4.txt b/test/snapshots/engine/evaluation_test/test_0030_inline_ruby_comment_multiline_d65c4c66f63611e90c0ea96b74af1ce4.txt index e6a72c5d1..46c14bfc5 100644 --- a/test/snapshots/engine/evaluation_test/test_0030_inline_ruby_comment_multiline_d65c4c66f63611e90c0ea96b74af1ce4.txt +++ b/test/snapshots/engine/evaluation_test/test_0030_inline_ruby_comment_multiline_d65c4c66f63611e90c0ea96b74af1ce4.txt @@ -2,4 +2,4 @@ source: "Engine::EvaluationTest#test_0030_inline ruby comment multiline" input: "{source: \"<% # Comment\\nmore %> <% code = \\\"test\\\" %><%= code %>\", locals: {more: \"ignored\"}, options: {escape: false}}" --- - test \ No newline at end of file +test \ No newline at end of file diff --git a/test/snapshots/engine/examples_compilation_test/test_0001_attributes_with_empty_value_compilation_441036c464ee35f7b120090fe76d6936.txt b/test/snapshots/engine/examples_compilation_test/test_0001_attributes_with_empty_value_compilation_441036c464ee35f7b120090fe76d6936.txt index c7a5557d5..460fc5a7a 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0001_attributes_with_empty_value_compilation_441036c464ee35f7b120090fe76d6936.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0001_attributes_with_empty_value_compilation_441036c464ee35f7b120090fe76d6936.txt @@ -2,7 +2,6 @@ source: "Engine::ExamplesCompilationTest#test_0001_attributes with empty value compilation" input: "{source: \"
\\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << '
+_buf = ::String.new; _buf << '
'.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0002_begin_compilation_cf3fa644ffeb7b672053fa0e989f55b5.txt b/test/snapshots/engine/examples_compilation_test/test_0002_begin_compilation_cf3fa644ffeb7b672053fa0e989f55b5.txt index 72b60435c..209d11ad9 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0002_begin_compilation_cf3fa644ffeb7b672053fa0e989f55b5.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0002_begin_compilation_cf3fa644ffeb7b672053fa0e989f55b5.txt @@ -2,13 +2,11 @@ source: "Engine::ExamplesCompilationTest#test_0002_begin compilation" input: "{source: \"<% begin %>\\n

Begin

\\n<% rescue StandardError => e %>\\n

Rescue

\\n<% ensure %>\\n

Ensure

\\n<% end %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - begin; _buf << ' -

Begin

-'.freeze; rescue StandardError => e; _buf << ' -

Rescue

-'.freeze; ensure; _buf << ' -

Ensure

-'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; begin + _buf << '

Begin

+'.freeze; rescue StandardError => e + _buf << '

Rescue

+'.freeze; ensure + _buf << '

Ensure

+'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0003_block_compilation_40b3cb480f677f54d2ff8f47af37f7fa.txt b/test/snapshots/engine/examples_compilation_test/test_0003_block_compilation_40b3cb480f677f54d2ff8f47af37f7fa.txt index d5ebb1333..5466164c2 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0003_block_compilation_40b3cb480f677f54d2ff8f47af37f7fa.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0003_block_compilation_40b3cb480f677f54d2ff8f47af37f7fa.txt @@ -2,13 +2,12 @@ source: "Engine::ExamplesCompilationTest#test_0003_block compilation" input: "{source: \"<% array = [\\\"One\\\", \\\"Two\\\", \\\"Three\\\"] %>\\n\\n
    \\n <% array.each do |item| %>\\n
  • <%= item %>
  • \\n <% end %>\\n
\\n\", options: {escape: false}}" --- -_buf = ::String.new; - array = ["One", "Two", "Three"]; _buf << ' - +_buf = ::String.new; array = ["One", "Two", "Three"] + _buf << '
    - '.freeze; array.each do |item|; _buf << ' -
  • '.freeze; _buf << (item).to_s; _buf << '
  • - '.freeze; end; _buf << ' -
+'.freeze; array.each do |item| + _buf << '
  • '.freeze; _buf << (item).to_s; _buf << '
  • +'.freeze; end + _buf << ' '.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0004_block_comment_compilation_d5c98b9f230e001f8aabf838d3774698.txt b/test/snapshots/engine/examples_compilation_test/test_0004_block_comment_compilation_d5c98b9f230e001f8aabf838d3774698.txt index 362575ebe..c88d96943 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0004_block_comment_compilation_d5c98b9f230e001f8aabf838d3774698.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0004_block_comment_compilation_d5c98b9f230e001f8aabf838d3774698.txt @@ -3,14 +3,13 @@ source: "Engine::ExamplesCompilationTest#test_0004_block comment compilation" input: "{source: \"<%\\n=begin %>\\n This, while unusual, is a legal form of commenting.\\n<%\\n=end %>\\n\\n
    Content
    \\n\", options: {escape: false}}" --- _buf = ::String.new; +=begin -=begin - _buf << ' - This, while unusual, is a legal form of commenting. + _buf << ' This, while unusual, is a legal form of commenting. '.freeze; -=end - _buf << ' +=end + _buf << '
    Content
    '.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0005_case_children_compilation_edc2f02149a3cdcced4e6d0830b5f251.txt b/test/snapshots/engine/examples_compilation_test/test_0005_case_children_compilation_edc2f02149a3cdcced4e6d0830b5f251.txt index a0c6ab903..d17222279 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0005_case_children_compilation_edc2f02149a3cdcced4e6d0830b5f251.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0005_case_children_compilation_edc2f02149a3cdcced4e6d0830b5f251.txt @@ -2,13 +2,12 @@ source: "Engine::ExamplesCompilationTest#test_0005_case children compilation" input: "{source: \"<% case variable %>\\n

    Children

    \\n<% when Integer %>\\n

    Integer

    \\n<% when String %>\\n

    String

    \\n<% else %>\\n

    else

    \\n<% end %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - case variable; when Integer; _buf << ' -

    Integer

    -'.freeze; when String; _buf << ' -

    String

    -'.freeze; else; _buf << ' -

    else

    -'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; case variable + when Integer + _buf << '

    Integer

    +'.freeze; when String + _buf << '

    String

    +'.freeze; else + _buf << '

    else

    +'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0006_case_in_compilation_6f13b7233db413c987e289ad2b3e3a3a.txt b/test/snapshots/engine/examples_compilation_test/test_0006_case_in_compilation_6f13b7233db413c987e289ad2b3e3a3a.txt index 36b0b6da9..d8db5512e 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0006_case_in_compilation_6f13b7233db413c987e289ad2b3e3a3a.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0006_case_in_compilation_6f13b7233db413c987e289ad2b3e3a3a.txt @@ -2,11 +2,10 @@ source: "Engine::ExamplesCompilationTest#test_0006_case in compilation" input: "{source: \"<% case {} %>\\n<% in {} %>\\n \\\"matched\\\"\\n<% else %>\\n \\\"not matched\\\"\\n<% end %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - case {}; in {}; _buf << ' - "matched" -'.freeze; else; _buf << ' - "not matched" -'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; case {} + in {} + _buf << ' "matched" +'.freeze; else + _buf << ' "not matched" +'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0007_case_when_compilation_3ee70e5b90c1ff368a7783c49c6dc611.txt b/test/snapshots/engine/examples_compilation_test/test_0007_case_when_compilation_3ee70e5b90c1ff368a7783c49c6dc611.txt index e9a678498..3f05709f1 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0007_case_when_compilation_3ee70e5b90c1ff368a7783c49c6dc611.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0007_case_when_compilation_3ee70e5b90c1ff368a7783c49c6dc611.txt @@ -2,23 +2,22 @@ source: "Engine::ExamplesCompilationTest#test_0007_case when compilation" input: "{source: \"<% case Date.today.cwday %>\\n<% when 0 %>\\n

    Today is Sunday

    \\n<% when 1 %>\\n

    Today is Monday

    \\n<% when 2 %>\\n

    Today is Tuesday

    \\n<% when 3 %>\\n

    Today is Wednesday

    \\n<% when 4 %>\\n

    Today is Thursday

    \\n<% when 5 %>\\n

    Today is Friday

    \\n<% when 6 %>\\n

    Today is Saturday

    \\n<% else %>\\n

    Today is not a day of the week

    \\n<% end %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - case Date.today.cwday; when 0; _buf << ' -

    Today is Sunday

    -'.freeze; when 1; _buf << ' -

    Today is Monday

    -'.freeze; when 2; _buf << ' -

    Today is Tuesday

    -'.freeze; when 3; _buf << ' -

    Today is Wednesday

    -'.freeze; when 4; _buf << ' -

    Today is Thursday

    -'.freeze; when 5; _buf << ' -

    Today is Friday

    -'.freeze; when 6; _buf << ' -

    Today is Saturday

    -'.freeze; else; _buf << ' -

    Today is not a day of the week

    -'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; case Date.today.cwday + when 0 + _buf << '

    Today is Sunday

    +'.freeze; when 1 + _buf << '

    Today is Monday

    +'.freeze; when 2 + _buf << '

    Today is Tuesday

    +'.freeze; when 3 + _buf << '

    Today is Wednesday

    +'.freeze; when 4 + _buf << '

    Today is Thursday

    +'.freeze; when 5 + _buf << '

    Today is Friday

    +'.freeze; when 6 + _buf << '

    Today is Saturday

    +'.freeze; else + _buf << '

    Today is not a day of the week

    +'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0008_comment_compilation_da96aac1987dbb33d41eb4a121419b47.txt b/test/snapshots/engine/examples_compilation_test/test_0008_comment_compilation_da96aac1987dbb33d41eb4a121419b47.txt index e65589503..adc2cfd6f 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0008_comment_compilation_da96aac1987dbb33d41eb4a121419b47.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0008_comment_compilation_da96aac1987dbb33d41eb4a121419b47.txt @@ -2,7 +2,6 @@ source: "Engine::ExamplesCompilationTest#test_0008_comment compilation" input: "{source: \"\\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << ' '.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0009_comment_before_content_compilation_2b3c4e3c244db77468813a7472298e82.txt b/test/snapshots/engine/examples_compilation_test/test_0009_comment_before_content_compilation_2b3c4e3c244db77468813a7472298e82.txt index 3d07109c9..344b807d5 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0009_comment_before_content_compilation_2b3c4e3c244db77468813a7472298e82.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0009_comment_before_content_compilation_2b3c4e3c244db77468813a7472298e82.txt @@ -2,8 +2,7 @@ source: "Engine::ExamplesCompilationTest#test_0009_comment before content compilation" input: "{source: \"<% # This file contains a comment before other content %>\\n
    Hey there
    \\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << '
    Hey there
    '.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0010_complete_erb_compilation_a33dd3e79d24b4f31f6d4e92611f3f63.txt b/test/snapshots/engine/examples_compilation_test/test_0010_complete_erb_compilation_a33dd3e79d24b4f31f6d4e92611f3f63.txt index 944197c5c..dc520ac0c 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0010_complete_erb_compilation_a33dd3e79d24b4f31f6d4e92611f3f63.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0010_complete_erb_compilation_a33dd3e79d24b4f31f6d4e92611f3f63.txt @@ -2,7 +2,6 @@ source: "Engine::ExamplesCompilationTest#test_0010_complete erb compilation" input: "{source: \"<%= hello %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << (hello).to_s; _buf << ' +_buf = ::String.new; _buf << (hello).to_s; _buf << ' '.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0011_doctype_compilation_8c18fb8399a2fd1e65b0333bc01e041c.txt b/test/snapshots/engine/examples_compilation_test/test_0011_doctype_compilation_8c18fb8399a2fd1e65b0333bc01e041c.txt index 41095fb77..30e2ca80c 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0011_doctype_compilation_8c18fb8399a2fd1e65b0333bc01e041c.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0011_doctype_compilation_8c18fb8399a2fd1e65b0333bc01e041c.txt @@ -2,8 +2,8 @@ source: "Engine::ExamplesCompilationTest#test_0011_doctype compilation" input: "{source: \" hello world this is inside the doctype>\\n\\n\\n\\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << ' diff --git a/test/snapshots/engine/examples_compilation_test/test_0012_erb_compilation_0109f6af5a474973b8b1b52636135c4f.txt b/test/snapshots/engine/examples_compilation_test/test_0012_erb_compilation_0109f6af5a474973b8b1b52636135c4f.txt index a1b2347c1..a44395cd9 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0012_erb_compilation_0109f6af5a474973b8b1b52636135c4f.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0012_erb_compilation_0109f6af5a474973b8b1b52636135c4f.txt @@ -2,8 +2,7 @@ source: "Engine::ExamplesCompilationTest#test_0012_erb compilation" input: "{source: \"
    \\n

    \\\">\\n <%= title %>\\n

    \\n
    \\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << '
    +_buf = ::String.new; _buf << '

    '.freeze; _buf << (title).to_s; _buf << '

    diff --git a/test/snapshots/engine/examples_compilation_test/test_0013_for_compilation_eeecb969def01ab8005c7b9f23686fed.txt b/test/snapshots/engine/examples_compilation_test/test_0013_for_compilation_eeecb969def01ab8005c7b9f23686fed.txt index 2191ed6a2..07390bc76 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0013_for_compilation_eeecb969def01ab8005c7b9f23686fed.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0013_for_compilation_eeecb969def01ab8005c7b9f23686fed.txt @@ -2,11 +2,9 @@ source: "Engine::ExamplesCompilationTest#test_0013_for compilation" input: "{source: \"<% names = [\\\"Alice\\\", \\\"Bob\\\", \\\"John\\\"] %>\\n\\n<% for name in names %>\\n

    Hello, <%= name %>!

    \\n<% end %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - names = ["Alice", "Bob", "John"]; _buf << ' - -'.freeze; for name in names; _buf << ' -

    Hello, '.freeze; _buf << (name).to_s; _buf << '!

    -'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; names = ["Alice", "Bob", "John"] + _buf << ' +'.freeze; for name in names + _buf << '

    Hello, '.freeze; _buf << (name).to_s; _buf << '!

    +'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0014_if_else_compilation_1437d0425640509570342c24b30de571.txt b/test/snapshots/engine/examples_compilation_test/test_0014_if_else_compilation_1437d0425640509570342c24b30de571.txt index 424fc050d..27c5b437e 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0014_if_else_compilation_1437d0425640509570342c24b30de571.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0014_if_else_compilation_1437d0425640509570342c24b30de571.txt @@ -2,15 +2,14 @@ source: "Engine::ExamplesCompilationTest#test_0014_if else compilation" input: "{source: \"

    \\n <% if true %>\\n
    Text1
    \\n <% elsif false %>\\n
    Text2
    \\n <% else %>\\n
    Text3
    \\n <% end %>\\n

    \\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << '

    - '.freeze; if true; _buf << ' -
    Text1
    - '.freeze; elsif false; _buf << ' -
    Text2
    - '.freeze; else; _buf << ' -
    Text3
    - '.freeze; end; _buf << ' -

    +_buf = ::String.new; _buf << '

    +'.freeze; if true + _buf << '
    Text1
    +'.freeze; elsif false + _buf << '
    Text2
    +'.freeze; else + _buf << '
    Text3
    +'.freeze; end + _buf << '

    '.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0015_line_wrap_compilation_ba78b92bec7a4692a2043f2ba2ebe057.txt b/test/snapshots/engine/examples_compilation_test/test_0015_line_wrap_compilation_ba78b92bec7a4692a2043f2ba2ebe057.txt index e21bcbd78..22e51ef67 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0015_line_wrap_compilation_ba78b92bec7a4692a2043f2ba2ebe057.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0015_line_wrap_compilation_ba78b92bec7a4692a2043f2ba2ebe057.txt @@ -2,7 +2,6 @@ source: "Engine::ExamplesCompilationTest#test_0015_line wrap compilation" input: "{source: \"
    \\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << '
    +_buf = ::String.new; _buf << '
    '.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0016_link_to_with_block_compilation_4ddb2a17755d3e775e3225970bc60a96.txt b/test/snapshots/engine/examples_compilation_test/test_0016_link_to_with_block_compilation_4ddb2a17755d3e775e3225970bc60a96.txt index 06b03d05c..0f64ddf7b 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0016_link_to_with_block_compilation_4ddb2a17755d3e775e3225970bc60a96.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0016_link_to_with_block_compilation_4ddb2a17755d3e775e3225970bc60a96.txt @@ -2,11 +2,9 @@ source: "Engine::ExamplesCompilationTest#test_0016_link to with block compilation" input: "{source: \"<%= link_to root_path do %>\\n
    \\n Test\\n
    \\n<% end %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << link_to root_path do; _buf << ' +_buf = ::String.new; _buf << link_to root_path do; _buf << '
    Test
    -'.freeze; end; _buf << ' -'.freeze; +'.freeze; end _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0017_nested_if_and_blocks_compilation_aa8aed9ef61b138a28efed42f4b72251.txt b/test/snapshots/engine/examples_compilation_test/test_0017_nested_if_and_blocks_compilation_aa8aed9ef61b138a28efed42f4b72251.txt index a570b9de1..c34e32da0 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0017_nested_if_and_blocks_compilation_aa8aed9ef61b138a28efed42f4b72251.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0017_nested_if_and_blocks_compilation_aa8aed9ef61b138a28efed42f4b72251.txt @@ -2,36 +2,35 @@ source: "Engine::ExamplesCompilationTest#test_0017_nested if and blocks compilation" input: "{source: \"
    \\n <%= tag.div class: \\\"div\\\" do %>\\n <% if Date.today.friday? %>\\n

    \\n Happy\\n <% current_hour = Time.now.hour %>\\n\\n <% if current_hour < 12 %>\\n Early Friday\\n <% elsif current_hour >= 18 %>\\n Late Friday\\n <% else %>\\n Friday\\n <% end %>\\n

    \\n <% elsif Date.today.saturday? %>\\n

    \\n It's\\n Saturday\\n <%= \\\" - Time to relax!\\\" %>\\n

    \\n <% else %>\\n

    \\n Oh no, it's\\n Not Friday\\n <%= \\\" - Keep going!\\\" %>\\n

    \\n <% end %>\\n <% end %>\\n
    \\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << '
    +_buf = ::String.new; _buf << '
    '.freeze; _buf << tag.div class: "div" do; _buf << ' - '.freeze; if Date.today.friday?; _buf << ' -

    +'.freeze; if Date.today.friday? + _buf << '

    Happy - '.freeze; current_hour = Time.now.hour; _buf << ' - - '.freeze; if current_hour < 12; _buf << ' - Early Friday - '.freeze; elsif current_hour >= 18; _buf << ' - Late Friday - '.freeze; else; _buf << ' - Friday - '.freeze; end; _buf << ' -

    - '.freeze; elsif Date.today.saturday?; _buf << ' -

    +'.freeze; current_hour = Time.now.hour + _buf << ' +'.freeze; if current_hour < 12 + _buf << ' Early Friday +'.freeze; elsif current_hour >= 18 + _buf << ' Late Friday +'.freeze; else + _buf << ' Friday +'.freeze; end + _buf << '

    +'.freeze; elsif Date.today.saturday? + _buf << '

    It\'s Saturday '.freeze; _buf << (" - Time to relax!").to_s; _buf << '

    - '.freeze; else; _buf << ' -

    +'.freeze; else + _buf << '

    Oh no, it\'s Not Friday '.freeze; _buf << (" - Keep going!").to_s; _buf << '

    - '.freeze; end; _buf << ' - '.freeze; end; _buf << ' -
    +'.freeze; end + end + _buf << '
    '.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0018_simple_block_compilation_1729fad3a77618acdc687c9fb671b75b.txt b/test/snapshots/engine/examples_compilation_test/test_0018_simple_block_compilation_1729fad3a77618acdc687c9fb671b75b.txt index 8f5b0fbe0..83a2fb689 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0018_simple_block_compilation_1729fad3a77618acdc687c9fb671b75b.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0018_simple_block_compilation_1729fad3a77618acdc687c9fb671b75b.txt @@ -2,13 +2,11 @@ source: "Engine::ExamplesCompilationTest#test_0018_simple block compilation" input: "{source: \"<% tag.div do %>\\n <% if true %>\\n Hello1\\n <% else %>\\n Hello2\\n <% end %>\\n<% end %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - tag.div do; _buf << ' - '.freeze; if true; _buf << ' - Hello1 - '.freeze; else; _buf << ' - Hello2 - '.freeze; end; _buf << ' -'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; tag.div do + if true + _buf << ' Hello1 +'.freeze; else + _buf << ' Hello2 +'.freeze; end + end _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0019_simple_erb_compilation_d81de4ca83482c4836215ef7177d9eec.txt b/test/snapshots/engine/examples_compilation_test/test_0019_simple_erb_compilation_d81de4ca83482c4836215ef7177d9eec.txt index b4fd3ecc5..a4ab4c419 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0019_simple_erb_compilation_d81de4ca83482c4836215ef7177d9eec.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0019_simple_erb_compilation_d81de4ca83482c4836215ef7177d9eec.txt @@ -2,7 +2,5 @@ source: "Engine::ExamplesCompilationTest#test_0019_simple erb compilation" input: "{source: \"<% title %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - title; _buf << ' -'.freeze; +_buf = ::String.new; title _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0020_test_compilation_9c22f391d1d03fa66b3d18095354a236.txt b/test/snapshots/engine/examples_compilation_test/test_0020_test_compilation_9c22f391d1d03fa66b3d18095354a236.txt index 99c4f0158..8f6911d65 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0020_test_compilation_9c22f391d1d03fa66b3d18095354a236.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0020_test_compilation_9c22f391d1d03fa66b3d18095354a236.txt @@ -2,8 +2,7 @@ source: "Engine::ExamplesCompilationTest#test_0020_test compilation" input: "{source: \"\\n\\n

    \\n Hello World <%= RUBY_VERSION %>\\n

    \\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << ' +_buf = ::String.new; _buf << '

    Hello World '.freeze; _buf << (RUBY_VERSION).to_s; _buf << ' diff --git a/test/snapshots/engine/examples_compilation_test/test_0021_until_compilation_0b1269c00fd15a74df125278ed6a9fc4.txt b/test/snapshots/engine/examples_compilation_test/test_0021_until_compilation_0b1269c00fd15a74df125278ed6a9fc4.txt index 21da76ad4..3ccfa1d23 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0021_until_compilation_0b1269c00fd15a74df125278ed6a9fc4.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0021_until_compilation_0b1269c00fd15a74df125278ed6a9fc4.txt @@ -2,12 +2,10 @@ source: "Engine::ExamplesCompilationTest#test_0021_until compilation" input: "{source: \"<% i = 0 %>\\n\\n<% until i == 10 %>\\n <%= i %> is less than 10\\n <% i += 1 %>\\n<% end %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - i = 0; _buf << ' - -'.freeze; until i == 10; _buf << ' - '.freeze; _buf << (i).to_s; _buf << ' is less than 10 - '.freeze; i += 1; _buf << ' -'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; i = 0 + _buf << ' +'.freeze; until i == 10 + _buf << ' '.freeze; _buf << (i).to_s; _buf << ' is less than 10 +'.freeze; i += 1 + end _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0022_utf8_compilation_45fa7aa654c0dc06d1a1b9504002dfba.txt b/test/snapshots/engine/examples_compilation_test/test_0022_utf8_compilation_45fa7aa654c0dc06d1a1b9504002dfba.txt index 5219686de..4acb59e6d 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0022_utf8_compilation_45fa7aa654c0dc06d1a1b9504002dfba.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0022_utf8_compilation_45fa7aa654c0dc06d1a1b9504002dfba.txt @@ -2,11 +2,10 @@ source: "Engine::ExamplesCompilationTest#test_0022_utf8 compilation" input: "{source: \"Sitename • Title\\n\\n<% @title = \\\"Home\\\" %>\\n\\n<%= [@title, \\\"Sitename\\\"].compact.join(\\\" • \\\") %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - _buf << 'Sitename • Title - -'.freeze; @title = "Home"; _buf << ' +_buf = ::String.new; _buf << 'Sitename • Title +'.freeze; @title = "Home" + _buf << ' '.freeze; _buf << ([@title, "Sitename"].compact.join(" • ")).to_s; _buf << ' '.freeze; _buf.to_s diff --git a/test/snapshots/engine/examples_compilation_test/test_0023_while_compilation_a705eb5ed83b4db368d7204baa136b36.txt b/test/snapshots/engine/examples_compilation_test/test_0023_while_compilation_a705eb5ed83b4db368d7204baa136b36.txt index 2dca71415..e19cd211b 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0023_while_compilation_a705eb5ed83b4db368d7204baa136b36.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0023_while_compilation_a705eb5ed83b4db368d7204baa136b36.txt @@ -2,10 +2,8 @@ source: "Engine::ExamplesCompilationTest#test_0023_while compilation" input: "{source: \"<% while i < 10 %>\\n <%= i %> is less than 10\\n <% i += 1 %>\\n<% end %>\\n\", options: {escape: false}}" --- -_buf = ::String.new; - while i < 10; _buf << ' - '.freeze; _buf << (i).to_s; _buf << ' is less than 10 - '.freeze; i += 1; _buf << ' -'.freeze; end; _buf << ' -'.freeze; +_buf = ::String.new; while i < 10 + _buf << ' '.freeze; _buf << (i).to_s; _buf << ' is less than 10 +'.freeze; i += 1 + end _buf.to_s diff --git a/test/snapshots/engine/validation_deduplication_test/test_0001_validation_errors_in_ERB_loops_generate_single_template_per_location_527dd13a0a4ec520816dc6bb5f4c7279.txt b/test/snapshots/engine/validation_deduplication_test/test_0001_validation_errors_in_ERB_loops_generate_single_template_per_location_527dd13a0a4ec520816dc6bb5f4c7279.txt index 401ad8a88..98dc825a7 100644 --- a/test/snapshots/engine/validation_deduplication_test/test_0001_validation_errors_in_ERB_loops_generate_single_template_per_location_527dd13a0a4ec520816dc6bb5f4c7279.txt +++ b/test/snapshots/engine/validation_deduplication_test/test_0001_validation_errors_in_ERB_loops_generate_single_template_per_location_527dd13a0a4ec520816dc6bb5f4c7279.txt @@ -2,8 +2,8 @@ source: "Engine::ValidationDeduplicationTest#test_0001_validation errors in ERB loops generate single template per location" input: "{source: \"<% 10.times do |i| %>
    >
    <% end %>\", options: {validation_mode: :overlay, filename: \"loop_test.html.erb\"}}" --- -_buf = ::String.new; - 10.times do |i|; _buf << '

    '.freeze; end; _buf << ('