true 1.0.1 → 2.0.0.alpha.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: ab5a6417b68be0dad0134effa015e923f4a655fd
4
- data.tar.gz: a52b1f776572e2b2219ed32fc6406a16412fda33
3
+ metadata.gz: 37fe1fa3625dd64810916dbff4ebfb8b00b7dec6
4
+ data.tar.gz: ae02b6aa2ff13fb3102e494e2d3322832e1a6170
5
5
  SHA512:
6
- metadata.gz: 12e482d1edbc75592f708d0e4a0b1ee914a158d62507042691184b9836dcceee9230fc46370090e712172aa5075aeae7ab0e77040b6ad34f037a226309b73485
7
- data.tar.gz: dab87289bd9df35090f56d1e501603a4d8cbd4fbdbcde4319d5a3f91299e68ff6e26274d360e669e1a47388b786bb8e850751209d62fafb020c134fc48a6e8a8
6
+ metadata.gz: ffde38be2ebbe2c7d44b5e8615ae25520b065ccfd39f56c7baf8fc6c21279692c667194e2969e083f9b84a998f8d606968fb2d12c46d7050b7cf1b4b7e2d95df
7
+ data.tar.gz: 68fc5538a15aa885ad0bf1bcdb04dfea75badd82a85ab59e361c3c47d3f3d78e9b46ea96abf0ad183e79912ce88833ecfa44755ba7ec398043ff6b2f9263617c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,19 @@
1
1
  True Changelog
2
2
  ==============
3
3
 
4
+ 2.0 (unreleased)
5
+ ----------------
6
+ - Improve internal logic, and namespace private functions behind `_true-*`.
7
+ - Add `assert()`, `input`, and `expect` mixins for testing CSS output.
8
+ - Support for LibSass
9
+ - Simplify output options down to single `$true-terminal-output` setting.
10
+
11
+
12
+ 1.0.1 (10/18/14)
13
+ ----------------
14
+ - LibSass 3.0 compatability.
15
+
16
+
4
17
  1.0.0 (10/3/14)
5
18
  ---------------
6
19
  - Add command-line interface: `true-cli <path-to-file>`
data/README.md CHANGED
@@ -1,26 +1,20 @@
1
- [![Build Status](https://travis-ci.org/ericam/true.png?branch=master)](https://travis-ci.org/ericam/true)
2
-
3
-
4
1
  True
5
2
  ====
6
3
 
4
+ [![Build Status](https://travis-ci.org/ericam/true.png?branch=master)](https://travis-ci.org/ericam/true)
5
+
7
6
  *Verb*
8
7
 
9
8
  1. To make true; shape, adjust, place, etc., exactly or accurately:
10
9
  *True the wheels of a bicycle after striking a pothole.*
11
10
  2. To make even, symmetrical, level, etc. (often followed by *up*):
12
11
  *True up the sides of a door.*
13
- 3. To test your Sass/Compass code; debug, perfect, etc. (often using *True*):
12
+ 3. To test your Sass code; debug, perfect, etc. (often using *True*):
14
13
  *True your sweet plugin before you deploy.*
15
14
 
16
15
  At this point
17
- True can only test values,
18
- not property/value output.
19
- I'm working on output tests as well.
20
- For now,
21
- use True for logical unit tests,
22
- and use version-control for integration testing
23
- by comparing changes in output files.
16
+ True can only test values (e.g. function returns),
17
+ not property/value output (e.g. mixin output).
24
18
 
25
19
 
26
20
  Install
@@ -28,17 +22,21 @@ Install
28
22
 
29
23
  in command line:
30
24
 
31
- `gem install true`
32
-
33
- in config.rb:
25
+ ```bash
26
+ # ruby gem
27
+ gem install true
34
28
 
35
- `require 'true'`
29
+ # bower package
30
+ bower install true
31
+ ```
36
32
 
37
33
 
38
34
  Command Line
39
- -----
35
+ ------------
40
36
 
41
- `true-cli [options] PATH`
37
+ ```bash
38
+ true-cli [options] PATH
39
+ ```
42
40
 
43
41
  Options:
44
42
  * `-s` slient
@@ -47,7 +45,7 @@ Options:
47
45
 
48
46
  Config file (optional):
49
47
 
50
- ``` yaml
48
+ ```yaml
51
49
  options:
52
50
  color: true #enables colored output
53
51
 
@@ -78,7 +76,7 @@ Usage
78
76
  'Returns the sum of two numeric maps');
79
77
  }
80
78
 
81
- @include test('Strict Equal [function]') {
79
+ @include test('Is Equal [function]') {
82
80
  $test: is-equal(1, 1rem);
83
81
  @include assert-equal($test, false,
84
82
  'Returns false for equal numbers with different units.');
@@ -88,19 +86,22 @@ Usage
88
86
  'Returns true for numbers that are truely equal.');
89
87
  }
90
88
  }
91
- ```
92
89
 
93
- **True** will report to both the terminal and an output css file by default.
94
-
95
- Here's a sample of the CSS output:
96
-
97
- ```css
98
- /* ### Utilities ---------- */
99
- /* - Map Add [function] (1 Assertions, 1 Passed, 0 Failed) */
100
- /* - Strict Equal [function] (2 Assertions, 2 Passed, 0 Failed) */
101
- /*
102
- */
103
- /* 2 Tests: */
104
- /* - 2 Passed */
105
- /* - 0 Failed */
90
+ @include report;
106
91
  ```
92
+
93
+ Settings
94
+ --------
95
+
96
+ There is only one setting.
97
+ `$true-terminal-output` controls what output (if any)
98
+ is shown in the terminal.
99
+ The default setting is `true`,
100
+ which will show warnings in the terminal
101
+ when an assertion fails.
102
+ You can set it to `false` to turn off all terminal output,
103
+ or `details` to show more `@debug` info on failures,
104
+ and a final summary of the results.
105
+
106
+ * LibSass doesn't support `@debug`.
107
+ * The Ruby CLI requires the final summary output.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 2.0.0.alpha.1
@@ -1,73 +1,157 @@
1
1
  // Assert
2
2
  // ======
3
3
 
4
+
4
5
  @mixin assert-true(
5
6
  $assert,
6
- $fail-message: ''
7
+ $description: ''
7
8
  ) {
8
- $name: map-get($test-results, name);
9
- $debug-message: '#{inspect($assert)} is not true';
9
+ @include _true-assert-start($description);
10
10
  $result: if($assert, pass, fail);
11
- @include report-assert($name, $result, $fail-message, $debug-message...);
11
+
12
+ .assert-true {
13
+ -result: to-upper-case($result);
14
+ -description: $description;
15
+
16
+ @if $result == fail {
17
+ @include _true-fail-details(true, $assert);
18
+ }
19
+ }
20
+
21
+ @include _true-assert-stop($result);
12
22
  }
13
23
 
24
+
14
25
  @mixin assert-false(
15
26
  $assert,
16
- $fail-message: ''
27
+ $description: ''
17
28
  ) {
18
- $name: map-get($test-results, name);
19
- $debug-message: '#{inspect($assert)} is not false';
20
- $result: if(not $assert, pass, fail);
21
- @include report-assert($name, $result, $fail-message, $debug-message...);
29
+ @include _true-assert-start($description);
30
+ $result: if($assert, fail, pass);
31
+
32
+ .assert-false {
33
+ -result: to-upper-case($result);
34
+ -description: $description;
35
+
36
+ @if $result == fail {
37
+ @include _true-fail-details(false, $assert);
38
+ }
39
+ }
40
+
41
+ @include _true-assert-stop($result);
22
42
  }
23
43
 
44
+
24
45
  @mixin assert-equal(
25
46
  $assert,
26
47
  $expected,
27
- $fail-message: ''
48
+ $description: ''
28
49
  ) {
29
- $name: map-get($test-results, name);
30
- $debug-message: 'Expected: #{inspect($expected)}',
31
- 'Result: #{inspect($assert)}';
32
- $result: if(is-equal($assert, $expected), pass, fail);
33
- @include report-assert($name, $result, $fail-message, $debug-message...);
50
+ @include _true-assert-start($description);
51
+ $result: if(_true-is-equal($assert, $expected), pass, fail);
52
+
53
+ .assert-equal {
54
+ -result: to-upper-case($result);
55
+ -description: $description;
56
+
57
+ @if $result == fail {
58
+ @include _true-fail-details($expected, $assert);
59
+ }
60
+ }
61
+
62
+ @include _true-assert-stop($result);
34
63
  }
35
64
 
65
+
36
66
  @mixin assert-unequal(
37
67
  $assert,
38
68
  $expected,
39
- $fail-message: ''
69
+ $description: ''
70
+ ) {
71
+ @include _true-assert-start($description);
72
+ $result: if(_true-is-equal($assert, $expected), fail, pass);
73
+
74
+ .assert-unequal {
75
+ -result: to-upper-case($result);
76
+ -description: $description;
77
+
78
+ @if $result == fail {
79
+ @include _true-fail-details($expected, $assert);
80
+ }
81
+ }
82
+
83
+ @include _true-assert-stop($result);
84
+ }
85
+
86
+
87
+ // CSS Output Tests
88
+ // ----------------
89
+
90
+ @mixin assert(
91
+ $description
40
92
  ) {
41
- $name: map-get($test-results, name);
42
- $debug-message: 'Expected: #{inspect($expected)}',
43
- 'Result: #{inspect($assert)}';
44
- $result: if(is-equal($assert, $expected), fail, pass);
45
- @include report-assert($name, $result, $fail-message, $debug-message...);
93
+ @include _true-assert-start($description);
94
+
95
+ #{_true-selector(assert)} {
96
+ @content;
97
+ }
98
+
99
+ @include _true-assert-stop(output-to-css);
100
+ }
101
+
102
+ @mixin input {
103
+ .input {
104
+ @content;
105
+ }
106
+ }
107
+
108
+ @mixin expect {
109
+ .expect {
110
+ @content;
111
+ }
46
112
  }
47
113
 
48
- // Pass / Fail
49
- // -----------
50
114
 
51
- @mixin report-assert(
52
- $name,
53
- $result,
54
- $fail-message: false,
55
- $debug...
115
+ // Assert Start
116
+ // ------------
117
+
118
+ @mixin _true-assert-start(
119
+ $name
56
120
  ) {
57
- @if $result == fail {
58
- @debug 'FAIL: #{$name}';
121
+ @include _true-context(assert, $name);
122
+ }
59
123
 
60
- @each $item in $debug {
61
- @debug $item;
62
- }
124
+ @mixin _true-assert-stop(
125
+ $result
126
+ ) {
127
+ @include _true-update(test, $result);
128
+ @include _true-context(assert, null);
129
+ }
63
130
 
64
- @if $fail-message {
65
- @warn $fail-message;
66
- }
67
131
 
68
- $test-details: $test-details + $-tnl + ' - error: '
69
- + '(#{$debug}) ' + $fail-message !global;
132
+ // Details
133
+ // -------
134
+
135
+ @mixin _true-fail-details(
136
+ $expected,
137
+ $returned,
138
+ $terminal: $true-terminal-output
139
+ ) {
140
+ $expected-type: type-of($expected);
141
+ $returned-type: type-of($returned);
142
+
143
+ -expected--#{$expected-type}: _true-inspect($expected);
144
+ -returned--#{$returned-type}: _true-inspect($returned);
145
+
146
+ @if $terminal == details {
147
+ @debug '[FAIL] #{_true-context(test)} » #{_true-context(assert)}';
148
+ @debug 'Expected #{$expected-type} »';
149
+ @debug inspect($expected);
150
+ @debug 'Returned #{$returned-type} »';
151
+ @debug inspect($returned);
70
152
  }
71
153
 
72
- $test-results: map-add($test-results, (run: 1, $result: 1)) !global;
154
+ @if $terminal {
155
+ @warn '#{_true-context(test)} » #{_true-context(assert)}';
156
+ }
73
157
  }
@@ -3,17 +3,36 @@
3
3
 
4
4
  $-tnl: "\a ";
5
5
 
6
- @mixin spacer-comment() {
6
+
7
+ // Return a CSS selector for the current context
8
+ @function _true-selector(
9
+ $scope
10
+ ) {
11
+ $selector: null;
12
+
13
+ @each $layer in $scope {
14
+ $this: '[data-#{$layer}="#{_true-context($layer)}"]';
15
+ $selector: if($selector, '#{$selector} #{$this}', $this);
16
+ }
17
+
18
+ @return $selector;
19
+ }
20
+
21
+
22
+ // Output a spacer comment
23
+ @mixin _true-spacer() {
7
24
  /*
8
25
  */
9
26
  }
10
27
 
11
- @mixin result-message(
28
+
29
+ // Output a message to CSS, Terminal, or Comments
30
+ @mixin _true-message(
12
31
  $message,
13
- $output
32
+ $output: comments
14
33
  ) {
15
- $lines: str-split($message, $-tnl);
16
- @if index($output, css) {
34
+ $lines: _true-str-split($message, $-tnl);
35
+ @if index($output, comments) {
17
36
  @each $line in $lines {
18
37
  /* #{$line} */
19
38
  }
@@ -1,60 +1,33 @@
1
1
  // Test Module
2
2
  // ===========
3
3
 
4
- $module-results: null;
5
4
 
6
5
  @mixin test-module(
7
- $name,
8
- $output: map-get($true, output)
6
+ $name
9
7
  ) {
10
- $module-results: $blank-results !global;
11
- @include setup-module($name, $output);
8
+ @include _true-module-start($name);
12
9
  @content;
13
- @include report-module($name, $module-results, $output);
14
- $module-results: null !global;
10
+ @include _true-module-stop;
15
11
  }
16
12
 
17
13
 
18
- // Module Setup (private)
14
+ // Module Start (private)
19
15
  // ----------------------
20
- @mixin setup-module(
21
- $name,
22
- $output: map-get($true, output)
23
- ) {
24
- // Initial CSS Output
25
- @if index($output, css) {
26
- @include result-message('### #{$name} ----------', css);
27
- }
28
- }
29
-
30
16
 
31
- // Module Results (private)
32
- // ------------------------
33
- @mixin report-module(
34
- $name,
35
- $module-results,
36
- $output: map-get($true, output)
17
+ @mixin _true-module-start(
18
+ $name
37
19
  ) {
20
+ @include _true-reset(module);
21
+ @include _true-context(module, $name);
22
+ @include _true-message('# #{$name} ----------', comments);
23
+ }
38
24
 
39
- // Terminal Results
40
- @if index($output, terminal) {
41
- $debug-message: '#{$name}: #{report($module-results, Tests)})';
42
- @include result-message($debug-message, debug);
43
- }
44
-
45
- // CSS Results
46
- @if index($output, css) {
47
- $run: map-get($module-results, run);
48
- $pass: map-get($module-results, pass);
49
- $fail: map-get($module-results, fail);
50
-
51
- $css-message: '#{$run} Tests:#{$-tnl} - #{$pass} Passed#{$-tnl} - #{$fail} Failed';
52
25
 
53
- @include spacer-comment;
54
- @include result-message($css-message, css);
55
- @include spacer-comment;
56
- }
26
+ // Module Stop (private)
27
+ // ---------------------
57
28
 
58
- // Add to Total
59
- $true-results: map-add($true-results, $module-results) !global;
29
+ @mixin _true-module-stop {
30
+ @include _true-update(global, null);
31
+ @include _true-reset(module);
32
+ @include _true-context(module, null);
60
33
  }
@@ -1,24 +1,150 @@
1
1
  // Results
2
2
  // =======
3
3
 
4
- @function report(
5
- $results: $true-results,
6
- $items: 'Tests'
4
+ $_true-results-reset: (
5
+ run: 0,
6
+ pass: 0,
7
+ fail: 0,
8
+ output-to-css: 0,
9
+ );
10
+
11
+ $_true-results: (
12
+ global: $_true-results-reset,
13
+ module: $_true-results-reset,
14
+ test: $_true-results-reset,
15
+ );
16
+
17
+
18
+ // Reset
19
+ // -----
20
+
21
+ @mixin _true-reset(
22
+ $scope
23
+ ) {
24
+ @if $scope == global {
25
+ $_true-results: (
26
+ global: $_true-results-reset,
27
+ module: $_true-results-reset,
28
+ test: $_true-results-reset,
29
+ ) !global;
30
+ } @else if $scope == module {
31
+ $update: (
32
+ module: $_true-results-reset,
33
+ test: $_true-results-reset,
34
+ );
35
+ $_true-results: map-merge($_true-results, $update) !global;
36
+ } @else if $scope == test {
37
+ $update: (
38
+ test: $_true-results-reset
39
+ );
40
+ $_true-results: map-merge($_true-results, $update) !global;
41
+ } @else {
42
+ @warn "#{$scope} is not a valid scope for _true-reset().";
43
+ }
44
+ }
45
+
46
+
47
+ // Get Results
48
+ // -----------
49
+
50
+ @function _true-get-results(
51
+ $scope
7
52
  ) {
53
+ @return map-get($_true-results, $scope);
54
+ }
55
+
56
+
57
+ // Get Result
58
+ // ----------
59
+
60
+ @function _true-get-result(
61
+ $scope
62
+ ) {
63
+ $results: _true-get-results($scope);
64
+ $return: if(map-get($results, output-to-css) > 0, output-to-css, null);
65
+
66
+ @if map-get($results, fail) > 0 {
67
+ @return if($return, $return fail, fail);
68
+ } @else if map-get($results, pass) > 0 {
69
+ @return if($return, $return pass, pass);
70
+ } @else {
71
+ @return $return;
72
+ }
73
+ }
74
+
75
+
76
+ // Update
77
+ // ------
78
+
79
+ @mixin _true-update(
80
+ $scope,
81
+ $results
82
+ ) {
83
+ $current: _true-get-results($scope);
84
+ $update: (run: 1);
85
+
86
+ @if $scope == global {
87
+ $update: _true-get-results(module);
88
+ } @else {
89
+ @each $result in $results {
90
+ @if $result {
91
+ $update: map-merge($update, ($result: 1));
92
+ }
93
+ }
94
+ }
95
+
96
+ $scope: ($scope: _true-map-increment($current, $update));
97
+ $_true-results: map-merge($_true-results, $scope) !global;
98
+ }
99
+
100
+
101
+ // Report Message
102
+ // --------------
103
+
104
+ @function _true-report-message(
105
+ $scope: test,
106
+ $lines: single
107
+ ) {
108
+ $results: _true-get-results($scope);
8
109
  $run: map-get($results, run);
9
110
  $pass: map-get($results, pass);
10
111
  $fail: map-get($results, fail);
112
+ $output-to-css: map-get($results, output-to-css);
11
113
 
12
- $message: '#{$run} #{$items}, #{$pass} Passed, #{$fail} Failed';
114
+ $items: null;
115
+ $message: null;
116
+
117
+ @if $scope == global or $scope == module {
118
+ $items: Tests;
119
+ } @else if $scope == test {
120
+ $items: Assertions;
121
+ }
122
+
123
+ @if $lines == single {
124
+ $message: '#{$run} #{$items}, #{$pass} Passed, #{$fail} Failed';
125
+ $message: if($output-to-css > 0, $message + ', #{$output-to-css} Output to CSS', $message);
126
+ } @else {
127
+ $message: '#{$run $items}:#{$-tnl} - #{$pass} Passed#{$-tnl} - #{$fail} Failed';
128
+ $message: if($output-to-css > 0, $message + '#{$-tnl} - #{$output-to-css} Output to CSS', $message);
129
+ }
13
130
 
14
131
  @return $message;
15
132
  }
16
133
 
134
+
135
+ // Report
136
+ // ------
137
+
17
138
  @mixin report(
18
- $output: map-get($true, summary)
139
+ $terminal: $true-terminal-output
19
140
  ) {
20
- $message: report($true-results);
21
- @if index($output, terminal) {
22
- @include result-message('SUMMARY: ' + $message, debug);
141
+ $message: _true-report-message(global, multiple);
142
+ @include _true-message('# SUMMARY ----------', comments);
143
+ @include _true-message($message, comments);
144
+ @include _true-message('--------------------', comments);
145
+
146
+ @if $terminal == details {
147
+ $message: _true-report-message(global, single);
148
+ @include _true-message($message, debug);
23
149
  }
24
150
  }
@@ -1,18 +1,27 @@
1
1
  // True Settings
2
2
  // =============
3
3
 
4
- $true: (
5
- output: css,
6
- summary: terminal css
7
- ) !default;
4
+ $true-terminal-output: true !default;
8
5
 
9
6
 
10
- // Results (private)
7
+ // Context (private)
11
8
  // -----------------
12
- $blank-results: (
13
- run: 0,
14
- pass: 0,
15
- fail: 0,
9
+
10
+ $_true-context: (
11
+ module: null,
12
+ test: null,
13
+ assert: null,
16
14
  );
17
15
 
18
- $true-results: $blank-results;
16
+ @mixin _true-context(
17
+ $scope,
18
+ $name
19
+ ) {
20
+ $_true-context: map-merge($_true-context, ($scope: $name)) !global;
21
+ }
22
+
23
+ @function _true-context(
24
+ $scope
25
+ ) {
26
+ @return map-get($_true-context, $scope);
27
+ }
@@ -1,69 +1,36 @@
1
1
  // Tests
2
2
  // =====
3
3
 
4
- $test-results: null;
5
- $test-details: '';
6
4
 
7
- // Establish a new test
8
5
  @mixin test(
9
- $name,
10
- $output: map-get($true, output)
6
+ $name
11
7
  ) {
12
- $test-results: map-merge($blank-results, (name: $name)) !global;
13
- $test-details: '' !global;
14
- @content;
15
- @include report-test($name, $test-results, $output, $test-details);
16
- $test-results: null !global;
17
- $test-details: '' !global;
18
- }
19
-
20
- // Report test results
21
- // -------------------
22
-
23
- @mixin report-test(
24
- $name,
25
- $results,
26
- $output: map-get($true, output),
27
- $details: ''
28
- ) {
29
- $pass: map-get($results, pass);
30
- $fail: map-get($results, fail);
31
- $result: if($fail > 0 or $pass < 1, fail, pass);
32
-
33
- $message: '#{$name} (#{report($results, Assertions)})';
8
+ @include _true-test-start($name);
34
9
 
35
- @include test-result($result, $message, $output, $details);
10
+ #{_true-selector(module test)} {
11
+ @content;
12
+ @include _true-test-stop;
13
+ }
36
14
  }
37
15
 
38
- // Pass / Fail Tests
39
- // -----------------
40
16
 
41
- @mixin test-result(
42
- $result,
43
- $message: '',
44
- $output: map-get($true, output),
45
- $details: ''
46
- ) {
47
- $css: null;
48
- $terminal: null;
17
+ // Module Start (private)
18
+ // ----------------------
49
19
 
50
- @if $result == fail {
51
- $message: if($message, $message, map-get($true, fail));
52
- $css: '- FAIL: ' + if($message, $message, '') + $details;
53
- $terminal: 'FAIL: ' + if($message, $message, '');
54
- } @else if $result == pass {
55
- $message: if($message, $message, map-get($true, pass));
56
- $css: '- ' + if($message, $message, '');
57
- $terminal: if($message, $message, '');
58
- }
20
+ @mixin _true-test-start(
21
+ $name
22
+ ) {
23
+ @include _true-reset(test);
24
+ @include _true-context(test, $name);
25
+ @include _true-message($name, comments);
26
+ }
59
27
 
60
- @if index($output, terminal) and $terminal {
61
- @include result-message($terminal, debug);
62
- }
63
28
 
64
- @if index($output, css) and $css {
65
- @include result-message($css, css);
66
- }
29
+ // Module Stop (private)
30
+ // ---------------------
67
31
 
68
- $module-results: map-add($module-results, (run: 1, $result: 1)) !global;
32
+ @mixin _true-test-stop {
33
+ @include _true-update(module, _true-get-result(test));
34
+ @include _true-reset(test);
35
+ @include _true-context(test, null);
69
36
  }
@@ -2,11 +2,13 @@
2
2
  // =========
3
3
 
4
4
  // Add map values together
5
- @function map-add(
5
+ @function _true-map-increment(
6
6
  $base,
7
7
  $add
8
8
  ) {
9
- @each $key, $value in $add {
9
+ @each $key in map-keys($add) {
10
+ $value: map-get($add, $key);
11
+
10
12
  @if $value {
11
13
  $base-value: map-get($base, $key);
12
14
  $new-value: if($base-value, $base-value + $value, $value);
@@ -18,7 +20,10 @@
18
20
  }
19
21
 
20
22
  // Split a string
21
- @function str-split($string, $substring) {
23
+ @function _true-str-split(
24
+ $string,
25
+ $substring
26
+ ) {
22
27
  $strings: ();
23
28
  $found-at: str-index($string, $substring);
24
29
  @while $found-at {
@@ -30,11 +35,39 @@
30
35
  @return $strings;
31
36
  }
32
37
 
38
+
33
39
  // Check for strict equality
34
- @function is-equal($one, $two) {
40
+ @function _true-is-equal($one, $two) {
35
41
  @if type-of($one) == number and type-of($two) == number {
36
42
  @return $one == $two and unit($one) == unit($two);
37
43
  } @else {
38
44
  @return $one == $two;
39
45
  }
40
46
  }
47
+
48
+
49
+ // Inspect
50
+ @function _true-inspect(
51
+ $value
52
+ ) {
53
+ @if function-exists(inspect) {
54
+ @if type-of($value) == map {
55
+ @return '#{inspect($value)}';
56
+ } @else {
57
+ @return inspect($value);
58
+ }
59
+ } @else if $value == null {
60
+ @return 'null';
61
+ } @else if type-of($value) == map {
62
+ $map: '(';
63
+ $keys: map-keys($value);
64
+ @each $key in $keys {
65
+ $val: map-get($value, $key);
66
+ $last: if(index($keys, $key) == length($keys), true, false);
67
+ $map: '#{$map}#{$key}: #{$val}#{if($last, ")", ", ")}';
68
+ }
69
+ @return $map;
70
+ } @else {
71
+ @return $value;
72
+ }
73
+ }
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: 1.0.1
4
+ version: 2.0.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Suzanne