File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,5 +185,29 @@ void my_custom_function(void) {
185185 expect ( reParsed ! . preamble ) . toContain ( '#define MY_MACRO 42' ) ;
186186 expect ( reParsed ! . postamble ) . toContain ( 'my_custom_function' ) ;
187187 } ) ;
188+
189+ it ( 'does not accumulate blank lines between array and postamble across round-trips' , ( ) => {
190+ const original = `#include QMK_KEYBOARD_H
191+
192+ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
193+ [0] = LAYOUT(KC_A, KC_B)
194+ };
195+
196+ layer_state_t layer_state_set_user(layer_state_t state) {
197+ return state;
198+ }
199+ ` ;
200+ let content = original ;
201+ for ( let i = 0 ; i < 5 ; i ++ ) {
202+ const parsed = parseKeymapC ( content ) ;
203+ expect ( parsed ) . not . toBeNull ( ) ;
204+ content = generateKeymapC ( parsed ! ) ;
205+ }
206+
207+ const blankLinesBetween = content
208+ . split ( '};' ) [ 1 ]
209+ . split ( 'layer_state_t' ) [ 0 ] ;
210+ expect ( blankLinesBetween ) . toBe ( '\n\n' ) ;
211+ } ) ;
188212 } ) ;
189213} ) ;
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ export function generateKeymapC(
5353 result += '\n' ;
5454 } ) ;
5555
56- result += '};\n ' ;
56+ result += '};' ;
5757 result += parsed . postamble ;
5858
5959 return result ;
You can’t perform that action at this time.
0 commit comments