meekrosoft / fff

A testing micro framework for creating function test doubles
Other
766 stars 167 forks source link

Refactorings #28

Closed usr42 closed 6 years ago

usr42 commented 7 years ago

I refactored some things. If you don't like some of the refactorings, I can revert the corresponding commit. These are the refactorings:

  1. Encapsulate pushd and popd inside of indent function. Indent has a block, so instead of

    pushd
    putd "int i;"
    popd

    you now write

    indent {
    putd "int i;"
    }

    This enforces a corresponding popd to each pushd and you can use indentation support of a text editor for the ruby code.

  2. Add putd_backslash which automatically adds a backslash at the end of a line of the generated code for multiline macros.

    putd "int i; \\"

    can now be written with

    putd_backslash "int i;"

    In my opinion this improves readability and enforces code style for the generated code.

  3. Replace putd "" by puts This generates empty lines instead of lines full of spaces.

  4. Remove dead code

usr42 commented 7 years ago

@meekrosoft I just solved the merge conflicts.

usr42 commented 6 years ago

@meekrosoft I've just solved the merge conflicts again. Can the pull request be merged. Do you like the idea of the changes?

usr42 commented 6 years ago

@meekrosoft The merge conflicts are solved again.