sass-spec icon indicating copy to clipboard operation
sass-spec copied to clipboard

Add specs for built-in functions

Open nex3 opened this issue 8 years ago • 2 comments

All the built-in functions need thorough specs that exercise their edge and error cases. There isn't currently a great structure in place for this; some functions have some specs scattered around the repo, but there should be a uniform location and we should make sure all functions are tested.

Ruby Sass has good test coverage for functions, so the best way to go about this is probably porting those. I suggest the following structure:

spec/
'-- core_function/
    |-- color/
    | ...
    '-- number/
        |-- round/
        | ...
        '-- max/
            |-- success/
            |   |-- input.scss
            |   '-- expected_output.scss
            '-- error/
                |-- type_error_arg1/
                |   |-- input.scss
                |   '-- expected_output.scss
                '-- type_error_arg2/
                    |-- input.scss
                    '-- expected_output.scss

For functions with more complex modes of operation, we could replace success/ with multiple test cases.

nex3 avatar Dec 12 '16 02:12 nex3

We should also retrofit the existing spec/colors/, spec/number-functions/, and spec/selector-functions/ into this format.

For the time being, I'm adding this structure lazily when I need to create a spec for a function.

nex3 avatar Dec 12 '16 02:12 nex3

@nex3 Can this be considered done now ?

stof avatar Feb 26 '22 00:02 stof