true 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66a0f767a421a3ff94af9713fb2c1291503494f8
4
- data.tar.gz: 6a4b3366382ebefe0e8b6580942f844b513358a3
3
+ metadata.gz: 813d58f9bc43892f91f7b74b5bc6ea2600ca6114
4
+ data.tar.gz: 0fbfe18b52a5e16799684ed2b8098fe6ca8399ef
5
5
  SHA512:
6
- metadata.gz: 04275f2cef76283d41e844fa761290f1b5b8988d5e42b42fb89e4b88fd69eace8c96ed79336c12e6fa57bce5f02df71d32aabf2ebf1640fbe8307573773d23a4
7
- data.tar.gz: bfe9aae3a9032e680ace7b0f16b08633c04bcc21c997b128ab7e0d41c963dd3de9d7825a0cd31a4deb24339cbd2351740d1080420221988e71abe39e3f801bb2
6
+ metadata.gz: 13271ce72f764066922c61799bb609a8005c3cb34d41698a3fae012c22209b7b2845ebe384051193aa754cdf9e163a7bf93fafa4e758e6230b279ba7a33c2292
7
+ data.tar.gz: 93fdbe9910e58534b29581e329192407332e9ee118dfd1196604695d3642b7279eae6ace975b82b0376f98e9dc5fb9ff7d591c5c8a10cea7920819597f49cc36
@@ -1,8 +1,8 @@
1
1
  True Changelog
2
2
  ==============
3
3
 
4
- 0.2.0 (unreleased)
5
- ------------------
4
+ 0.2.0 (7/15/14)
5
+ ---------------
6
6
  - Simplified reporting in both terminal and CSS.
7
7
  - Remove `default-module-output`, `$default-test-output` and `$default-final-output`.
8
8
  Replace them with `$true` settings map: `(output: css, summary: terminal css)`.
@@ -10,32 +10,40 @@ True Changelog
10
10
  Assertions are always output to the terminal if they fail.
11
11
  - Update to use Sass map variables.
12
12
  - Add `report` function and `report` mixin, for reporting final results.
13
- - Only register as a compass extension if compass is present. Compass is
14
- no longer an explicit dependency.
13
+ - Only register as a compass extension if compass is present.
14
+ Compass is no longer an explicit dependency.
15
+ - Adjust the output styles to work with Sass 3.4
16
+ and have more visual consistency.
17
+
15
18
 
16
19
  0.1.5 (6/10/13)
17
20
  ---------------
18
21
  - Append actual results to custom failure messages.
19
22
 
23
+
20
24
  0.1.4 (6/9/13)
21
25
  --------------
22
26
  - Null result is considered a failure.
23
27
  - Allow output to be turned off for certain modules/tests/assertions.
24
28
 
29
+
25
30
  0.1.3 (6/7/13)
26
31
  --------------
27
32
  - Nest assertions within `test() {}` named tests.
28
33
  - Cleaner css output.
29
34
 
35
+
30
36
  0.1.2 (6/7/13)
31
37
  --------------
32
38
  - Use nesting for modules with `test-module() {}`
33
39
  - Added failure message argument to all assertions.
34
40
 
41
+
35
42
  0.1.1 (6/6/13)
36
43
  --------------
37
44
  - Fix bug in `lib/true.rb` compass plugin registration.
38
45
 
46
+
39
47
  0.1.0 (6/6/13)
40
48
  --------------
41
49
  - `assert-true()`, `assert-false()`, `assert-equal()`, and `assert-unequal()`.
@@ -4,9 +4,9 @@ begin
4
4
  Compass::Frameworks.register('true', :stylesheets_directory => true_stylesheets_path)
5
5
  rescue LoadError
6
6
  # compass not found, register on the Sass path via the environment.
7
- if ENV.has_key?("SASSPATH")
8
- ENV["SASSPATH"] = ENV["SASSPATH"] + File::PATH_SEPARATOR + true_stylesheets_path
7
+ if ENV.key? 'SASS_PATH'
8
+ ENV['SASS_PATH'] += File::PATH_SEPARATOR + true_stylesheets_path
9
9
  else
10
- ENV["SASSPATH"] = true_stylesheets_path
10
+ ENV['SASS_PATH'] = true_stylesheets_path
11
11
  end
12
12
  end
@@ -5,20 +5,20 @@
5
5
  $assert,
6
6
  $fail-message: ''
7
7
  ) {
8
- $test: map-get($test-results, name);
9
- $fail-message: '#{$test}: ' + $fail-message + ' (#{inspect($assert)} is not true)';
8
+ $name: map-get($test-results, name);
9
+ $debug-message: '#{inspect($assert)} is not true';
10
10
  $result: if($assert, pass, fail);
11
- @include report-assert($result, $fail-message);
11
+ @include report-assert($name, $result, $fail-message, $debug-message...);
12
12
  }
13
13
 
14
14
  @mixin assert-false(
15
15
  $assert,
16
16
  $fail-message: ''
17
17
  ) {
18
- $test: map-get($test-results, name);
19
- $fail-message: '#{$test}: ' + $fail-message + ' (#{inspect($assert)} is not false)';
18
+ $name: map-get($test-results, name);
19
+ $debug-message: '#{inspect($assert)} is not false';
20
20
  $result: if(not $assert, pass, fail);
21
- @include report-assert($result, $fail-message);
21
+ @include report-assert($name, $result, $fail-message, $debug-message...);
22
22
  }
23
23
 
24
24
  @mixin assert-equal(
@@ -26,10 +26,11 @@
26
26
  $expected,
27
27
  $fail-message: ''
28
28
  ) {
29
- $test: map-get($test-results, name);
30
- $fail-message: '#{$test}: ' + $fail-message + ' (Expected: #{inspect($expected)} != Result: #{inspect($assert)})';
29
+ $name: map-get($test-results, name);
30
+ $debug-message: 'Expected: #{inspect($expected)}',
31
+ 'Result: #{inspect($assert)}';
31
32
  $result: if($assert == $expected, pass, fail);
32
- @include report-assert($result, $fail-message);
33
+ @include report-assert($name, $result, $fail-message, $debug-message...);
33
34
  }
34
35
 
35
36
  @mixin assert-unequal(
@@ -37,21 +38,34 @@
37
38
  $expected,
38
39
  $fail-message: ''
39
40
  ) {
40
- $test: map-get($test-results, name);
41
- $fail-message: '#{$test}: ' + $fail-message + ' (Expected: #{inspect($expected)} == Result: #{inspect($assert)})';
41
+ $name: map-get($test-results, name);
42
+ $debug-message: 'Expected: #{inspect($expected)}',
43
+ 'Result: #{inspect($assert)}';
42
44
  $result: if($assert != $expected, pass, fail);
43
- @include report-assert($result, $fail-message);
45
+
46
+ @include report-assert($name, $result, $fail-message, $debug-message...);
44
47
  }
45
48
 
46
49
  // Pass / Fail
47
50
  // -----------
48
51
 
49
52
  @mixin report-assert(
53
+ $name,
50
54
  $result,
51
- $fail-message: ''
55
+ $fail-message: false,
56
+ $debug...
52
57
  ) {
53
- @if $result == fail and $fail-message {
54
- @warn $fail-message;
58
+ @if $result == fail {
59
+ @debug 'FAIL: #{$name}';
60
+
61
+ @each $item in $debug {
62
+ @debug $item;
63
+ }
64
+
65
+ @if $fail-message {
66
+ @warn $fail-message;
67
+ }
55
68
  }
69
+
56
70
  $test-results: map-add($test-results, (run: 1, $result: 1)) !global;
57
71
  }
@@ -1,15 +1,34 @@
1
1
  // Messages
2
2
  // ========
3
3
 
4
+ $-tnl: "\a ";
5
+
6
+ @mixin spacer-comment() {
7
+ /*
8
+ */
9
+ }
10
+
4
11
  @mixin result-message(
5
12
  $message,
6
13
  $output
7
14
  ) {
15
+ $lines: str-split($message, $-tnl);
8
16
  @if index($output, css) {
9
- /* #{$message} */
17
+ @each $line in $lines {
18
+ /* #{$line} */
19
+ }
10
20
  } @else if index($output, debug) or index($output, terminal) {
11
- @debug $message;
21
+ @each $line in $lines {
22
+ @debug $line;
23
+ }
12
24
  } @else if index($output, warn) {
13
25
  @warn $message;
26
+ @each $line in $lines {
27
+ @if index($lines, $line) == length($lines) {
28
+ @warn $line;
29
+ } @else {
30
+ @debug $line;
31
+ }
32
+ }
14
33
  }
15
34
  }
@@ -23,9 +23,7 @@ $module-results: null;
23
23
  ) {
24
24
  // Initial CSS Output
25
25
  @if index($output, css) {
26
- @include result-message('
27
-
28
- ### #{$name} ------', css);
26
+ @include result-message('#{$-tnl}### #{$name} ----------', css);
29
27
  }
30
28
  }
31
29
 
@@ -50,11 +48,13 @@ $module-results: null;
50
48
  $pass: map-get($module-results, pass);
51
49
  $fail: map-get($module-results, fail);
52
50
 
53
- $css-message: '
54
- #{$run} Tests:
55
- - #{$pass} Passed
56
- - #{$fail} Failed';
51
+ $css-message: '#{$-tnl}#{$run} Tests:' +
52
+ '#{$-tnl}- #{$pass} Passed' +
53
+ '#{$-tnl}- #{$fail} Failed';
54
+
55
+ @include spacer-comment;
57
56
  @include result-message($css-message, css);
57
+ @include spacer-comment;
58
58
  }
59
59
 
60
60
  // Add to Total
@@ -36,3 +36,16 @@
36
36
  @return $return + ')';
37
37
  }
38
38
  }
39
+
40
+ // Split a string
41
+ @function str-split($string, $substring) {
42
+ $strings: ();
43
+ $found-at: str-index($string, $substring);
44
+ @while $found-at {
45
+ $strings: if($found-at > 1, append($strings, str-slice($string, 1, $found-at - 1)), $strings);
46
+ $string: str-slice($string, $found-at + str-length($substring));
47
+ $found-at: str-index($string, $substring);
48
+ }
49
+ $strings: append($strings, $string);
50
+ @return $strings;
51
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 'true'
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Meyer
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '1.2'
81
81
  requirements: []
82
82
  rubyforge_project: 'true'
83
- rubygems_version: 2.0.3
83
+ rubygems_version: 2.1.10
84
84
  signing_key:
85
85
  specification_version: 3
86
86
  summary: Testing framework for Sass libraries.