true 0.1.5 → 0.2.0.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +10 -0
- data/README.md +152 -21
- data/sass/_true.scss +2 -0
- data/sass/true/_assert.scss +33 -20
- data/sass/true/_modules.scss +40 -23
- data/sass/true/_results.scss +13 -93
- data/sass/true/_settings.scss +18 -0
- data/sass/true/_tests.scss +49 -12
- data/sass/true/_utilities.scss +18 -0
- metadata +14 -37
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            --- 
         | 
| 2 | 
            +
            SHA512: 
         | 
| 3 | 
            +
              data.tar.gz: 6f95ec4f7cdf95ebafed598af43669a6ce28e8852b5bd2428daf4c05b7bc2f699475591768b26dd36d83e83d381aa74aa7a051354e62c98f81976e99d749df50
         | 
| 4 | 
            +
              metadata.gz: d872cde92572c3e64cc67095de8a9acbe9371983a2c3ed3740777b4939ff9699c2d32a375b09a49792c4842b36aa0e3259595dbadd212b4651e9038feafefd9f
         | 
| 5 | 
            +
            SHA1: 
         | 
| 6 | 
            +
              data.tar.gz: 217e7b41d4e4e3cb2e6a6c489b0f5c10c39683c0
         | 
| 7 | 
            +
              metadata.gz: 05def0e5b64adad25f18216bce150543bc42dbf9
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,6 +1,16 @@ | |
| 1 1 | 
             
            True Changelog
         | 
| 2 2 | 
             
            ==============
         | 
| 3 3 |  | 
| 4 | 
            +
            0.2.0 (unreleased)
         | 
| 5 | 
            +
            ------------------
         | 
| 6 | 
            +
            - Simplified reporting in both terminal and CSS.
         | 
| 7 | 
            +
            - Remove `default-module-output`, `$default-test-output` and `$default-final-output`.
         | 
| 8 | 
            +
              Replace them with `$true` settings map: `(output: css, summary: terminal css)`.
         | 
| 9 | 
            +
              `output` handles test/module output, `summary` handles final output.
         | 
| 10 | 
            +
              Assertions are always output to the terminal if they fail.
         | 
| 11 | 
            +
            - Update to use Sass map variables.
         | 
| 12 | 
            +
            - Add `report` function and `report` mixin, for reporting final results.
         | 
| 13 | 
            +
             | 
| 4 14 | 
             
            0.1.5 (6/10/13)
         | 
| 5 15 | 
             
            ---------------
         | 
| 6 16 | 
             
            - Append actual results to custom failure messages.
         | 
    
        data/README.md
    CHANGED
    
    | @@ -7,16 +7,15 @@ True | |
| 7 7 | 
             
              *True the wheels of a bicycle after striking a pothole.*
         | 
| 8 8 | 
             
            2. To make even, symmetrical, level, etc. (often followed by *up*):
         | 
| 9 9 | 
             
              *True up the sides of a door.*
         | 
| 10 | 
            -
            3.  | 
| 11 | 
            -
              *True your  | 
| 10 | 
            +
            3. To test your Sass/Compass code; debug, perfect, etc. (often using *True*):
         | 
| 11 | 
            +
              *True your sweet plugin before you deploy.*
         | 
| 12 12 |  | 
| 13 13 | 
             
            At this point
         | 
| 14 14 | 
             
            True can only test values,
         | 
| 15 15 | 
             
            not property/value output.
         | 
| 16 | 
            -
            I' | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
            you use True for logical unit tests,
         | 
| 16 | 
            +
            I'm working on output tests as well.
         | 
| 17 | 
            +
            For now,
         | 
| 18 | 
            +
            use True for logical unit tests,
         | 
| 20 19 | 
             
            and use version-control for integration testing
         | 
| 21 20 | 
             
            by comparing changes in output files.
         | 
| 22 21 |  | 
| @@ -34,31 +33,163 @@ in config.rb: | |
| 34 33 | 
             
            Usage
         | 
| 35 34 | 
             
            -----
         | 
| 36 35 |  | 
| 37 | 
            -
             | 
| 36 | 
            +
            Production example from
         | 
| 37 | 
            +
            [Susy Next](https://github.com/ericam/susy/blob/susy-next/test/scss/math/_columns.scss):
         | 
| 38 38 |  | 
| 39 39 | 
             
            ```scss
         | 
| 40 40 | 
             
            @import "true";
         | 
| 41 41 |  | 
| 42 | 
            -
            //  | 
| 43 | 
            -
             | 
| 42 | 
            +
            // Column Math Tests
         | 
| 43 | 
            +
            // =================
         | 
| 44 44 |  | 
| 45 | 
            -
             | 
| 46 | 
            -
              @include test('Feature A does The Things') {
         | 
| 47 | 
            -
                $test-1: 3*5;
         | 
| 48 | 
            -
                $test-2: if(something, true, false);
         | 
| 45 | 
            +
            @include test-module('Column Math') {
         | 
| 49 46 |  | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
                  'Simple multiplication of `3*5` should return `15`.');
         | 
| 47 | 
            +
              // Is Symmetrical
         | 
| 48 | 
            +
              // --------------
         | 
| 53 49 |  | 
| 54 | 
            -
             | 
| 55 | 
            -
                 | 
| 56 | 
            -
                 | 
| 57 | 
            -
             | 
| 50 | 
            +
              @include test('[function] is-symmetrical()') {
         | 
| 51 | 
            +
                $sym: 12;
         | 
| 52 | 
            +
                $asym: 1 2 4 1 2 1;
         | 
| 53 | 
            +
                $baz: compact(4);
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                // 12 is a symmetrical grid.
         | 
| 56 | 
            +
                $s: is-symmetrical($sym);
         | 
| 57 | 
            +
                @include assert-true($s,
         | 
| 58 | 
            +
                  'Simple number should be symmetrical grid.');
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                // (1 2 4 1 2 1) is not a symmetrical grid.
         | 
| 61 | 
            +
                $a: is-symmetrical($asym);
         | 
| 62 | 
            +
                @include assert-false($a,
         | 
| 63 | 
            +
                  'List should be asymmetrical grid.');
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                // compact(4) is not a symmetrical grid (because it is a list).
         | 
| 66 | 
            +
                $b: is-symmetrical($baz);
         | 
| 67 | 
            +
                @include assert-false($b,
         | 
| 68 | 
            +
                  'Single-item list should be asymmetrical grid.');
         | 
| 69 | 
            +
              }
         | 
| 70 | 
            +
             | 
| 71 | 
            +
             | 
| 72 | 
            +
              // Column Count
         | 
| 73 | 
            +
              // ------------
         | 
| 74 | 
            +
             | 
| 75 | 
            +
              @include test('[function] column-count()') {
         | 
| 76 | 
            +
                $sym: 12;
         | 
| 77 | 
            +
                $asym: 1 2 4 1 2 1;
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                // A symmetrical grid is equal to its column count.
         | 
| 80 | 
            +
                $s-count: column-count($sym);
         | 
| 81 | 
            +
                @include assert-equal($s-count, $sym,
         | 
| 82 | 
            +
                  'Symmetrical grid-count should equal $columns setting.');
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                // An asymmetrical grid has a column-count equal to its length.
         | 
| 85 | 
            +
                $a-count: column-count($asym);
         | 
| 86 | 
            +
                $a-length: length($asym);
         | 
| 87 | 
            +
                @include assert-equal($a-count, $a-length,
         | 
| 88 | 
            +
                  'Asymmetrical grid-count should equal $columns length.');
         | 
| 89 | 
            +
              }
         | 
| 90 | 
            +
             | 
| 91 | 
            +
             | 
| 92 | 
            +
              // Column Sum
         | 
| 93 | 
            +
              // ----------
         | 
| 94 | 
            +
             | 
| 95 | 
            +
              @include test('[function] symmetrical column-sum()') {
         | 
| 96 | 
            +
                $cols   : 9;
         | 
| 97 | 
            +
                $guts   : .5;
         | 
| 98 | 
            +
                $sum    : column-sum($cols, $guts);
         | 
| 99 | 
            +
                $outer  : column-sum($cols, $guts, outer);
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                @include assert-equal($sum, 13,
         | 
| 102 | 
            +
                  'Column-sum for "9 .5" should be "13".');
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                @include assert-equal($outer, 13.5,
         | 
| 105 | 
            +
                  'Outer column-sum for "9 .5" should be "13.5".');
         | 
| 106 | 
            +
              }
         | 
| 107 | 
            +
             | 
| 108 | 
            +
              @include test('[function] asymmetrical column-sum()') {
         | 
| 109 | 
            +
                $sum    : column-sum(1 2 3 1 2, .25);
         | 
| 110 | 
            +
                $outer  : column-sum(1 2 3 1 2, .25, outer);
         | 
| 111 | 
            +
             | 
| 112 | 
            +
                @include assert-equal($sum, 10,
         | 
| 113 | 
            +
                  'Column-sum for "(1 2 3 1 2) .25" should be "10".');
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                @include assert-equal($outer, 10.25,
         | 
| 116 | 
            +
                  'Outer column-sum for "(1 2 3 1 2) .25" should be "10.25".');
         | 
| 117 | 
            +
              }
         | 
| 118 | 
            +
             | 
| 119 | 
            +
             | 
| 120 | 
            +
              // Get Columns
         | 
| 121 | 
            +
              // -----------
         | 
| 122 | 
            +
             | 
| 123 | 
            +
              @include test('[function] symmetrical get-columns()') {
         | 
| 124 | 
            +
                $span: 3;
         | 
| 125 | 
            +
                $context: 12;
         | 
| 126 | 
            +
                $sub: get-columns($span, 4, $context);
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                @include assert-equal($sub, $span,
         | 
| 129 | 
            +
                  'Symmetrical get-columns subset should be equal to its span.');
         | 
| 130 | 
            +
              }
         | 
| 131 | 
            +
             | 
| 132 | 
            +
              @include test('[function] asymmetrical get-columns()') {
         | 
| 133 | 
            +
                $span: 3;
         | 
| 134 | 
            +
                $context: 1 2 3 1 2;
         | 
| 135 | 
            +
                $sub: get-columns($span, 2, $context);
         | 
| 136 | 
            +
             | 
| 137 | 
            +
                @include assert-equal($sub, 2 3 1,
         | 
| 138 | 
            +
                  'Get-columns subset for "3 of (1 2 3 1 2) at 2" should be "2 3 1".');
         | 
| 139 | 
            +
              }
         | 
| 140 | 
            +
             | 
| 141 | 
            +
             | 
| 142 | 
            +
              // Get Column Span Sum
         | 
| 143 | 
            +
              // -------------------
         | 
| 144 | 
            +
             | 
| 145 | 
            +
              @include test('[function] symmetrical get-column-span-sum()') {
         | 
| 146 | 
            +
                $cols: 12;
         | 
| 147 | 
            +
                $guts: 1/8;
         | 
| 148 | 
            +
             | 
| 149 | 
            +
                $sum: get-column-span-sum(3, 2, $cols, $guts);
         | 
| 150 | 
            +
                @include assert-equal($sum, 3.25,
         | 
| 151 | 
            +
                  'Inner span-sum for "3 of 12 1/8 at 2" should be "3.25"');
         | 
| 152 | 
            +
             | 
| 153 | 
            +
                $sum: get-column-span-sum(3, last, $cols, $guts, outer);
         | 
| 154 | 
            +
                @include assert-equal($sum, 3.375,
         | 
| 155 | 
            +
                  'Outer span-sum for "last 3 of 12 1/8" should be "3.375".');
         | 
| 156 | 
            +
              }
         | 
| 157 | 
            +
             | 
| 158 | 
            +
              @include test('[function] asymmetrical get-column-span-sum()') {
         | 
| 159 | 
            +
                $cols: 1 2 3 2 1 2 3;
         | 
| 160 | 
            +
                $guts: 1/4;
         | 
| 161 | 
            +
             | 
| 162 | 
            +
                $sum: get-column-span-sum(3, 2, $cols, $guts);
         | 
| 163 | 
            +
                @include assert-equal($sum, 7.5,
         | 
| 164 | 
            +
                  'Inner span-sum for "3 at 2 of (1 2 3 2 1 2 3)" should be "7.5".');
         | 
| 165 | 
            +
             | 
| 166 | 
            +
                $sum: get-column-span-sum(3, last, $cols, $guts, outer);
         | 
| 167 | 
            +
                @include assert-equal($sum, 6.75,
         | 
| 168 | 
            +
                  'Outer span-sum for "last 3 of (1 2 3 2 1 2 3)" should be "6.75".');
         | 
| 58 169 | 
             
              }
         | 
| 59 170 |  | 
| 60 171 | 
             
            }
         | 
| 61 172 | 
             
            ```
         | 
| 62 173 |  | 
| 63 174 | 
             
            **True** will report detailed results in the terminal,
         | 
| 64 | 
            -
            and a summary of results in the output css.
         | 
| 175 | 
            +
            and a summary of results in the output css.
         | 
| 176 | 
            +
             | 
| 177 | 
            +
            Here's the Susy "Column Math" CSS output:
         | 
| 178 | 
            +
             | 
| 179 | 
            +
            ```css
         | 
| 180 | 
            +
            /*
         | 
| 181 | 
            +
             | 
| 182 | 
            +
            ### Column Math ------ */
         | 
| 183 | 
            +
            /*  - [function] is-symmetrical() (3 Assertions, 3 Passed, 0 Failed) */
         | 
| 184 | 
            +
            /*  - [function] column-count() (2 Assertions, 2 Passed, 0 Failed) */
         | 
| 185 | 
            +
            /*  - [function] symmetrical column-sum() (2 Assertions, 2 Passed, 0 Failed) */
         | 
| 186 | 
            +
            /*  - [function] asymmetrical column-sum() (2 Assertions, 2 Passed, 0 Failed) */
         | 
| 187 | 
            +
            /*  - [function] symmetrical get-columns() (1 Assertions, 1 Passed, 0 Failed) */
         | 
| 188 | 
            +
            /*  - [function] asymmetrical get-columns() (1 Assertions, 1 Passed, 0 Failed) */
         | 
| 189 | 
            +
            /*  - [function] symmetrical get-column-span-sum() (2 Assertions, 2 Passed, 0 Failed) */
         | 
| 190 | 
            +
            /*  - [function] asymmetrical get-column-span-sum() (2 Assertions, 2 Passed, 0 Failed) */
         | 
| 191 | 
            +
            /*
         | 
| 192 | 
            +
                8 Tests:
         | 
| 193 | 
            +
                - 8 Passed
         | 
| 194 | 
            +
                - 0 Failed */
         | 
| 195 | 
            +
            ```
         | 
    
        data/sass/_true.scss
    CHANGED
    
    
    
        data/sass/true/_assert.scss
    CHANGED
    
    | @@ -3,42 +3,55 @@ | |
| 3 3 |  | 
| 4 4 | 
             
            @mixin assert-true(
         | 
| 5 5 | 
             
              $assert,
         | 
| 6 | 
            -
              $fail-message:  | 
| 6 | 
            +
              $fail-message: ''
         | 
| 7 7 | 
             
            ) {
         | 
| 8 | 
            -
              $ | 
| 9 | 
            -
              $fail-message: $fail-message + $ | 
| 10 | 
            -
               | 
| 11 | 
            -
              @ | 
| 8 | 
            +
              $test: map-get($test-results, name);
         | 
| 9 | 
            +
              $fail-message: '#{$test}: ' + $fail-message + ' (#{$assert} is not true)';
         | 
| 10 | 
            +
              $result: if($assert, pass, fail);
         | 
| 11 | 
            +
              @include report-assert($result, $fail-message);
         | 
| 12 12 | 
             
            }
         | 
| 13 13 |  | 
| 14 14 | 
             
            @mixin assert-false(
         | 
| 15 15 | 
             
              $assert,
         | 
| 16 | 
            -
              $fail-message:  | 
| 16 | 
            +
              $fail-message: ''
         | 
| 17 17 | 
             
            ) {
         | 
| 18 | 
            -
              $ | 
| 19 | 
            -
              $fail-message: $fail-message + $ | 
| 20 | 
            -
               | 
| 21 | 
            -
              @ | 
| 18 | 
            +
              $test: map-get($test-results, name);
         | 
| 19 | 
            +
              $fail-message: '#{$test}: ' + $fail-message + ' (#{$assert} is not false)';
         | 
| 20 | 
            +
              $result: if(not $assert, pass, fail);
         | 
| 21 | 
            +
              @include report-assert($result, $fail-message);
         | 
| 22 22 | 
             
            }
         | 
| 23 23 |  | 
| 24 24 | 
             
            @mixin assert-equal(
         | 
| 25 25 | 
             
              $assert,
         | 
| 26 26 | 
             
              $expected,
         | 
| 27 | 
            -
              $fail-message:  | 
| 27 | 
            +
              $fail-message: ''
         | 
| 28 28 | 
             
            ) {
         | 
| 29 | 
            -
              $ | 
| 30 | 
            -
              $fail-message: $fail-message + $ | 
| 31 | 
            -
               | 
| 32 | 
            -
              @ | 
| 29 | 
            +
              $test: map-get($test-results, name);
         | 
| 30 | 
            +
              $fail-message: '#{$test}: ' + $fail-message + ' (#{$assert} != #{$expected})';
         | 
| 31 | 
            +
              $result: if($assert == $expected, pass, fail);
         | 
| 32 | 
            +
              @include report-assert($result, $fail-message);
         | 
| 33 33 | 
             
            }
         | 
| 34 34 |  | 
| 35 35 | 
             
            @mixin assert-unequal(
         | 
| 36 36 | 
             
              $assert,
         | 
| 37 37 | 
             
              $expected,
         | 
| 38 | 
            -
              $fail-message:  | 
| 38 | 
            +
              $fail-message: ''
         | 
| 39 39 | 
             
            ) {
         | 
| 40 | 
            -
              $ | 
| 41 | 
            -
              $fail-message: $fail-message + $ | 
| 42 | 
            -
               | 
| 43 | 
            -
              @ | 
| 40 | 
            +
              $test: map-get($test-results, name);
         | 
| 41 | 
            +
              $fail-message: '#{$test}: ' + $fail-message + ' (#{$assert} == #{$expected})';
         | 
| 42 | 
            +
              $result: if($assert != $expected, pass, fail);
         | 
| 43 | 
            +
              @include report-assert($result, $fail-message);
         | 
| 44 | 
            +
            }
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            // Pass / Fail
         | 
| 47 | 
            +
            // -----------
         | 
| 48 | 
            +
             | 
| 49 | 
            +
            @mixin report-assert(
         | 
| 50 | 
            +
              $result,
         | 
| 51 | 
            +
              $fail-message: ''
         | 
| 52 | 
            +
            ) {
         | 
| 53 | 
            +
              @if $result == fail and $fail-message {
         | 
| 54 | 
            +
                @warn $fail-message;
         | 
| 55 | 
            +
              }
         | 
| 56 | 
            +
              $test-results: map-add($test-results, (run: 1, $result: 1)) !global;
         | 
| 44 57 | 
             
            }
         | 
    
        data/sass/true/_modules.scss
    CHANGED
    
    | @@ -1,45 +1,62 @@ | |
| 1 | 
            -
            // Test  | 
| 2 | 
            -
            //  | 
| 1 | 
            +
            // Test Module
         | 
| 2 | 
            +
            // ===========
         | 
| 3 3 |  | 
| 4 | 
            -
            $ | 
| 4 | 
            +
            $module-results: null;
         | 
| 5 5 |  | 
| 6 | 
            -
            // Establish a new test module
         | 
| 7 6 | 
             
            @mixin test-module(
         | 
| 8 7 | 
             
              $name,
         | 
| 9 | 
            -
              $output: true
         | 
| 8 | 
            +
              $output: map-get($true, output)
         | 
| 10 9 | 
             
            ) {
         | 
| 11 | 
            -
               | 
| 12 | 
            -
              $ | 
| 13 | 
            -
               | 
| 10 | 
            +
              $module-results: $blank-results !global;
         | 
| 11 | 
            +
              @include setup-module($name, $output);
         | 
| 12 | 
            +
              @content;
         | 
| 13 | 
            +
              @include report-module($name, $module-results, $output);
         | 
| 14 | 
            +
              $module-results: null !global;
         | 
| 15 | 
            +
            }
         | 
| 16 | 
            +
             | 
| 14 17 |  | 
| 15 | 
            -
             | 
| 18 | 
            +
            // Module Setup (private)
         | 
| 19 | 
            +
            // ----------------------
         | 
| 20 | 
            +
            @mixin setup-module(
         | 
| 21 | 
            +
              $name,
         | 
| 22 | 
            +
              $output: map-get($true, output)
         | 
| 23 | 
            +
            ) {
         | 
| 24 | 
            +
              // Initial CSS Output
         | 
| 25 | 
            +
              @if index($output, css) {
         | 
| 16 26 | 
             
                @include result-message('
         | 
| 17 27 |  | 
| 18 28 | 
             
            ### #{$name} ------', css);
         | 
| 19 29 | 
             
              }
         | 
| 30 | 
            +
            }
         | 
| 20 31 |  | 
| 21 | 
            -
              // Content
         | 
| 22 | 
            -
              @content;
         | 
| 23 32 |  | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 33 | 
            +
            // Module Results (private)
         | 
| 34 | 
            +
            // ------------------------
         | 
| 35 | 
            +
            @mixin report-module(
         | 
| 36 | 
            +
              $name,
         | 
| 37 | 
            +
              $module-results,
         | 
| 38 | 
            +
              $output: map-get($true, output)
         | 
| 39 | 
            +
            ) {
         | 
| 30 40 |  | 
| 31 | 
            -
             | 
| 41 | 
            +
              // Terminal Results
         | 
| 42 | 
            +
              @if index($output, terminal) {
         | 
| 43 | 
            +
                $debug-message: '#{$name}: #{report($module-results, Tests)})';
         | 
| 32 44 | 
             
                @include result-message($debug-message, debug);
         | 
| 45 | 
            +
              }
         | 
| 46 | 
            +
             | 
| 47 | 
            +
              // CSS Results
         | 
| 48 | 
            +
              @if index($output, css) {
         | 
| 49 | 
            +
                $run: map-get($module-results, run);
         | 
| 50 | 
            +
                $pass: map-get($module-results, pass);
         | 
| 51 | 
            +
                $fail: map-get($module-results, fail);
         | 
| 33 52 |  | 
| 34 53 | 
             
                $css-message: '
         | 
| 35 | 
            -
                 | 
| 36 | 
            -
                - #{$total} Tests
         | 
| 54 | 
            +
                #{$run} Tests:
         | 
| 37 55 | 
             
                - #{$pass} Passed
         | 
| 38 56 | 
             
                - #{$fail} Failed';
         | 
| 39 57 | 
             
                @include result-message($css-message, css);
         | 
| 40 58 | 
             
              }
         | 
| 41 59 |  | 
| 42 | 
            -
              //  | 
| 43 | 
            -
              $ | 
| 44 | 
            -
              $test-module-results: null;
         | 
| 60 | 
            +
              // Add to Total
         | 
| 61 | 
            +
              $true-results: map-add($true-results, $module-results) !global;
         | 
| 45 62 | 
             
            }
         | 
    
        data/sass/true/_results.scss
    CHANGED
    
    | @@ -1,104 +1,24 @@ | |
| 1 1 | 
             
            // Results
         | 
| 2 2 | 
             
            // =======
         | 
| 3 3 |  | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
            $ | 
| 7 | 
            -
            $fail-marker          : f;
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            $test-pass-message    : '.'       !default;
         | 
| 10 | 
            -
            $test-fail-message    : 'F'       !default;
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            // Collate test results
         | 
| 13 | 
            -
            // --------------------
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            @function collate-results(
         | 
| 16 | 
            -
              $results
         | 
| 17 | 
            -
            ) {
         | 
| 18 | 
            -
              $total: length($results);
         | 
| 19 | 
            -
              $pass: 0;
         | 
| 20 | 
            -
              $fail: 0;
         | 
| 21 | 
            -
             | 
| 22 | 
            -
              @each $test in $results {
         | 
| 23 | 
            -
                @if $test == $pass-marker { $pass: $pass + 1; }
         | 
| 24 | 
            -
                @if $test == $fail-marker { $fail: $fail + 1; }
         | 
| 25 | 
            -
              }
         | 
| 26 | 
            -
             | 
| 27 | 
            -
              @return $total $pass $fail;
         | 
| 28 | 
            -
            }
         | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
            // Record test results
         | 
| 32 | 
            -
            // -------------------
         | 
| 33 | 
            -
             | 
| 34 | 
            -
            @mixin record-result(
         | 
| 35 | 
            -
              $result,
         | 
| 36 | 
            -
              $context: $test-result-context
         | 
| 4 | 
            +
            @function report(
         | 
| 5 | 
            +
              $results: $true-results,
         | 
| 6 | 
            +
              $items: 'Tests'
         | 
| 37 7 | 
             
            ) {
         | 
| 38 | 
            -
              $ | 
| 8 | 
            +
              $run: map-get($results, run);
         | 
| 9 | 
            +
              $pass: map-get($results, pass);
         | 
| 10 | 
            +
              $fail: map-get($results, fail);
         | 
| 39 11 |  | 
| 40 | 
            -
               | 
| 41 | 
            -
                $marker: $pass-marker;
         | 
| 42 | 
            -
              } @else if $result == 'fail' {
         | 
| 43 | 
            -
                $marker: $fail-marker;
         | 
| 44 | 
            -
              }
         | 
| 12 | 
            +
              $message: '#{$run} #{$items}, #{$pass} Passed, #{$fail} Failed';
         | 
| 45 13 |  | 
| 46 | 
            -
               | 
| 47 | 
            -
              @if $context == 'test' {
         | 
| 48 | 
            -
                $test-results: append($test-results, $marker);
         | 
| 49 | 
            -
              } @else if $context == 'module' {
         | 
| 50 | 
            -
                $test-module-results: append($test-module-results, $marker);
         | 
| 51 | 
            -
              }
         | 
| 14 | 
            +
              @return $message;
         | 
| 52 15 | 
             
            }
         | 
| 53 16 |  | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
            // -------------------
         | 
| 57 | 
            -
             | 
| 58 | 
            -
            @mixin report-test(
         | 
| 59 | 
            -
              $name,
         | 
| 60 | 
            -
              $results,
         | 
| 61 | 
            -
              $context: module,
         | 
| 62 | 
            -
              $output: true
         | 
| 17 | 
            +
            @mixin report(
         | 
| 18 | 
            +
              $output: map-get($true, summary)
         | 
| 63 19 | 
             
            ) {
         | 
| 64 | 
            -
              $ | 
| 65 | 
            -
               | 
| 66 | 
            -
             | 
| 67 | 
            -
              $fail: nth($results, 3);
         | 
| 68 | 
            -
             | 
| 69 | 
            -
              $message: '#{$name} (#{$total} assertions, #{$pass} passed, #{$fail} failed)';
         | 
| 70 | 
            -
             | 
| 71 | 
            -
              @if $fail > 0 or $pass < 1 {
         | 
| 72 | 
            -
                $fail-message: '- FAIL: ' + $message;
         | 
| 73 | 
            -
                @include fail($fail-message, $context, $output: $output);
         | 
| 74 | 
            -
                @if $output { @include result-message('FAIL: ' + $message, css); }
         | 
| 20 | 
            +
              $message: report($true-results);
         | 
| 21 | 
            +
              @if index($output, terminal) {
         | 
| 22 | 
            +
                @include result-message('SUMMARY: ' + $message, debug);
         | 
| 75 23 | 
             
              }
         | 
| 76 | 
            -
              @else {
         | 
| 77 | 
            -
                $pass-message: '- ' + $message;
         | 
| 78 | 
            -
                @include pass($test-pass-message, $context, $output: $output);
         | 
| 79 | 
            -
                @if $output { @include result-message($pass-message, css); }
         | 
| 80 | 
            -
              }
         | 
| 81 | 
            -
             | 
| 82 | 
            -
            }
         | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
            // Pass / Fail
         | 
| 86 | 
            -
            // -----------
         | 
| 87 | 
            -
             | 
| 88 | 
            -
            @mixin pass(
         | 
| 89 | 
            -
              $pass: $test-pass-message,
         | 
| 90 | 
            -
              $context: $test-result-context,
         | 
| 91 | 
            -
              $output: true
         | 
| 92 | 
            -
            ) {
         | 
| 93 | 
            -
              @include record-result(pass, $context);
         | 
| 94 | 
            -
              @if $output { @include result-message($pass, debug); }
         | 
| 95 | 
            -
            }
         | 
| 96 | 
            -
             | 
| 97 | 
            -
            @mixin fail(
         | 
| 98 | 
            -
              $fail: $test-fail-message,
         | 
| 99 | 
            -
              $context: $test-result-context,
         | 
| 100 | 
            -
              $output: true
         | 
| 101 | 
            -
            ) {
         | 
| 102 | 
            -
              @include record-result(fail, $context);
         | 
| 103 | 
            -
              @if $output { @include result-message($fail, warn); }
         | 
| 104 24 | 
             
            }
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            // True Settings
         | 
| 2 | 
            +
            // =============
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            $true: (
         | 
| 5 | 
            +
              output: css,
         | 
| 6 | 
            +
              summary: terminal css
         | 
| 7 | 
            +
            ) !default;
         | 
| 8 | 
            +
             | 
| 9 | 
            +
             | 
| 10 | 
            +
            // Results (private)
         | 
| 11 | 
            +
            // -----------------
         | 
| 12 | 
            +
            $blank-results: (
         | 
| 13 | 
            +
              run: 0,
         | 
| 14 | 
            +
              pass: 0,
         | 
| 15 | 
            +
              fail: 0,
         | 
| 16 | 
            +
            );
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            $true-results: $blank-results;
         | 
    
        data/sass/true/_tests.scss
    CHANGED
    
    | @@ -6,22 +6,59 @@ $test-results: null; | |
| 6 6 | 
             
            // Establish a new test
         | 
| 7 7 | 
             
            @mixin test(
         | 
| 8 8 | 
             
              $name,
         | 
| 9 | 
            -
              $output: true
         | 
| 9 | 
            +
              $output: map-get($true, output)
         | 
| 10 10 | 
             
            ) {
         | 
| 11 | 
            -
               | 
| 12 | 
            -
               | 
| 11 | 
            +
              $test-results: map-merge($blank-results, (name: $name)) !global;
         | 
| 12 | 
            +
              @content;
         | 
| 13 | 
            +
              @include report-test($name, $test-results, $output);
         | 
| 14 | 
            +
              $test-results: null !global;
         | 
| 15 | 
            +
            }
         | 
| 13 16 |  | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
              $test-result-context: test;
         | 
| 17 | 
            +
            // Report test results
         | 
| 18 | 
            +
            // -------------------
         | 
| 17 19 |  | 
| 18 | 
            -
             | 
| 20 | 
            +
            @mixin report-test(
         | 
| 21 | 
            +
              $name,
         | 
| 22 | 
            +
              $results,
         | 
| 23 | 
            +
              $output: map-get($true, output)
         | 
| 24 | 
            +
            ) {
         | 
| 25 | 
            +
              $pass: map-get($results, pass);
         | 
| 26 | 
            +
              $fail: map-get($results, fail);
         | 
| 27 | 
            +
              $result: if($fail > 0 or $pass < 1, fail, pass);
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              $message: '#{$name} (#{report($results, Assertions)})';
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              @include test-result($result, $message, $output);
         | 
| 32 | 
            +
            }
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            // Pass / Fail Tests
         | 
| 35 | 
            +
            // -----------------
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            @mixin test-result(
         | 
| 38 | 
            +
              $result,
         | 
| 39 | 
            +
              $message: '',
         | 
| 40 | 
            +
              $output: map-get($true, output)
         | 
| 41 | 
            +
            ) {
         | 
| 42 | 
            +
              $css: null;
         | 
| 43 | 
            +
              $terminal: null;
         | 
| 44 | 
            +
             | 
| 45 | 
            +
              @if $result == fail {
         | 
| 46 | 
            +
                $message: if($message, $message, map-get($true, fail));
         | 
| 47 | 
            +
                $css: '- FAIL: ' + if($message, $message, '');
         | 
| 48 | 
            +
                $terminal: 'FAIL: ' + if($message, $message, '');
         | 
| 49 | 
            +
              } @else if $result == pass {
         | 
| 50 | 
            +
                $message: if($message, $message, map-get($true, pass));
         | 
| 51 | 
            +
                $css: '- ' + if($message, $message, '');
         | 
| 52 | 
            +
                $terminal: if($message, $message, '');
         | 
| 53 | 
            +
              }
         | 
| 19 54 |  | 
| 20 | 
            -
              $ | 
| 55 | 
            +
              @if index($output, terminal) and $terminal {
         | 
| 56 | 
            +
                @include result-message($terminal, debug);
         | 
| 57 | 
            +
              }
         | 
| 21 58 |  | 
| 22 | 
            -
               | 
| 23 | 
            -
             | 
| 59 | 
            +
              @if index($output, css) and $css {
         | 
| 60 | 
            +
                @include result-message($css, css);
         | 
| 61 | 
            +
              }
         | 
| 24 62 |  | 
| 25 | 
            -
               | 
| 26 | 
            -
              $test-results: null;
         | 
| 63 | 
            +
              $module-results: map-add($module-results, (run: 1, $result: 1)) !global;
         | 
| 27 64 | 
             
            }
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            // Utilities
         | 
| 2 | 
            +
            // =========
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            // Add map values together
         | 
| 5 | 
            +
            @function map-add(
         | 
| 6 | 
            +
              $base,
         | 
| 7 | 
            +
              $add
         | 
| 8 | 
            +
            ) {
         | 
| 9 | 
            +
              @each $key, $value in $add {
         | 
| 10 | 
            +
                @if $value {
         | 
| 11 | 
            +
                  $base-value: map-get($base, $key);
         | 
| 12 | 
            +
                  $new-value: if($base-value, $base-value + $value, $value);
         | 
| 13 | 
            +
                  $base: map-merge($base, ($key: $new-value));
         | 
| 14 | 
            +
                }
         | 
| 15 | 
            +
              }
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              @return $base;
         | 
| 18 | 
            +
            }
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: "true"
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
               | 
| 5 | 
            -
              prerelease: 
         | 
| 6 | 
            -
              segments: 
         | 
| 7 | 
            -
              - 0
         | 
| 8 | 
            -
              - 1
         | 
| 9 | 
            -
              - 5
         | 
| 10 | 
            -
              version: 0.1.5
         | 
| 4 | 
            +
              version: 0.2.0.rc.1
         | 
| 11 5 | 
             
            platform: ruby
         | 
| 12 6 | 
             
            authors: 
         | 
| 13 7 | 
             
            - Eric Meyer
         | 
| @@ -15,41 +9,29 @@ autorequire: | |
| 15 9 | 
             
            bindir: bin
         | 
| 16 10 | 
             
            cert_chain: []
         | 
| 17 11 |  | 
| 18 | 
            -
            date: 2013- | 
| 12 | 
            +
            date: 2013-10-22 00:00:00 Z
         | 
| 19 13 | 
             
            dependencies: 
         | 
| 20 14 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 21 15 | 
             
              name: compass
         | 
| 22 16 | 
             
              prerelease: false
         | 
| 23 17 | 
             
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 24 | 
            -
                none: false
         | 
| 25 18 | 
             
                requirements: 
         | 
| 26 | 
            -
                - -  | 
| 19 | 
            +
                - - ~>
         | 
| 27 20 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 28 | 
            -
                     | 
| 29 | 
            -
                    segments: 
         | 
| 30 | 
            -
                    - 0
         | 
| 31 | 
            -
                    - 12
         | 
| 32 | 
            -
                    - 2
         | 
| 33 | 
            -
                    version: 0.12.2
         | 
| 21 | 
            +
                    version: 0.13.alpha.7
         | 
| 34 22 | 
             
              type: :runtime
         | 
| 35 23 | 
             
              version_requirements: *id001
         | 
| 36 24 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 37 25 | 
             
              name: sass
         | 
| 38 26 | 
             
              prerelease: false
         | 
| 39 27 | 
             
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 40 | 
            -
                none: false
         | 
| 41 28 | 
             
                requirements: 
         | 
| 42 | 
            -
                - -  | 
| 29 | 
            +
                - - ~>
         | 
| 43 30 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 44 | 
            -
                     | 
| 45 | 
            -
                    segments: 
         | 
| 46 | 
            -
                    - 3
         | 
| 47 | 
            -
                    - 2
         | 
| 48 | 
            -
                    - 0
         | 
| 49 | 
            -
                    version: 3.2.0
         | 
| 31 | 
            +
                    version: 3.3.0.rc.1
         | 
| 50 32 | 
             
              type: :runtime
         | 
| 51 33 | 
             
              version_requirements: *id002
         | 
| 52 | 
            -
            description:  | 
| 34 | 
            +
            description: Unit tests for maintaining test-driven Sass/Compass extensions.
         | 
| 53 35 | 
             
            email: 
         | 
| 54 36 | 
             
            - eric@oddbird.net
         | 
| 55 37 | 
             
            executables: []
         | 
| @@ -68,13 +50,17 @@ files: | |
| 68 50 | 
             
            - sass/true/_messages.scss
         | 
| 69 51 | 
             
            - sass/true/_modules.scss
         | 
| 70 52 | 
             
            - sass/true/_results.scss
         | 
| 53 | 
            +
            - sass/true/_settings.scss
         | 
| 71 54 | 
             
            - sass/true/_tests.scss
         | 
| 55 | 
            +
            - sass/true/_utilities.scss
         | 
| 72 56 | 
             
            - CHANGELOG.md
         | 
| 73 57 | 
             
            - LICENSE.txt
         | 
| 74 58 | 
             
            - README.md
         | 
| 75 | 
            -
            homepage: http:// | 
| 59 | 
            +
            homepage: http://eric.andmeyer.com/true
         | 
| 76 60 | 
             
            licenses: []
         | 
| 77 61 |  | 
| 62 | 
            +
            metadata: {}
         | 
| 63 | 
            +
             | 
| 78 64 | 
             
            post_install_message: 
         | 
| 79 65 | 
             
            rdoc_options: 
         | 
| 80 66 | 
             
            - --line-numbers
         | 
| @@ -86,30 +72,21 @@ rdoc_options: | |
| 86 72 | 
             
            require_paths: 
         | 
| 87 73 | 
             
            - lib
         | 
| 88 74 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 89 | 
            -
              none: false
         | 
| 90 75 | 
             
              requirements: 
         | 
| 91 76 | 
             
              - - ">="
         | 
| 92 77 | 
             
                - !ruby/object:Gem::Version 
         | 
| 93 | 
            -
                  hash: 3
         | 
| 94 | 
            -
                  segments: 
         | 
| 95 | 
            -
                  - 0
         | 
| 96 78 | 
             
                  version: "0"
         | 
| 97 79 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 98 | 
            -
              none: false
         | 
| 99 80 | 
             
              requirements: 
         | 
| 100 81 | 
             
              - - ">="
         | 
| 101 82 | 
             
                - !ruby/object:Gem::Version 
         | 
| 102 | 
            -
                  hash: 11
         | 
| 103 | 
            -
                  segments: 
         | 
| 104 | 
            -
                  - 1
         | 
| 105 | 
            -
                  - 2
         | 
| 106 83 | 
             
                  version: "1.2"
         | 
| 107 84 | 
             
            requirements: []
         | 
| 108 85 |  | 
| 109 86 | 
             
            rubyforge_project: "true"
         | 
| 110 | 
            -
            rubygems_version:  | 
| 87 | 
            +
            rubygems_version: 2.0.3
         | 
| 111 88 | 
             
            signing_key: 
         | 
| 112 89 | 
             
            specification_version: 3
         | 
| 113 | 
            -
            summary: Testing framework for  | 
| 90 | 
            +
            summary: Testing framework for Sass libraries.
         | 
| 114 91 | 
             
            test_files: []
         | 
| 115 92 |  |