true 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/sass/true/_assert.scss +73 -7
- data/sass/true/_messages.scss +21 -4
- data/sass/true/_modules.scss +20 -1
- data/sass/true/_results.scss +49 -0
- data/sass/true/_settings.scss +22 -0
- data/sass/true/_tests.scss +22 -1
- data/sass/true/_utilities.scss +18 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6a7100c98f736aaf9d6ef973ba5c5fc0231acdd
|
4
|
+
data.tar.gz: 9a6425828c5a712a6735d26d36c51fe7c9ae331a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dba31e95f10290485d251692881ea8af645bbe075d9a9820646f417f98cc8fe4a335339b5733bc9897ae3a60116c6c999b2af2bf0625bd59dde1eaa1c09c55b
|
7
|
+
data.tar.gz: 15de231bffdd88378eb45908d6b3e473f019389fee8aa428bc57d6409e44c7a03d8db8b9dc612d0aed63ed81c60eed1a5c02fe5d00f72296c1f084d9f8e5cbdc
|
data/CHANGELOG.md
CHANGED
data/sass/true/_assert.scss
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
// ======
|
3
3
|
|
4
4
|
|
5
|
+
/// Assert that a parameter is `true`
|
6
|
+
/// @access public
|
7
|
+
/// @group testing
|
8
|
+
/// @param {*} $assert - Assert
|
9
|
+
/// @param {String} $description [''] - Assert description
|
10
|
+
/// @require {mixin} _true-fail-details
|
11
|
+
/// @require {mixin} _true-assert-start
|
12
|
+
/// @require {mixin} _true-assert-stop
|
5
13
|
@mixin assert-true(
|
6
14
|
$assert,
|
7
15
|
$description: ''
|
@@ -21,7 +29,14 @@
|
|
21
29
|
@include _true-assert-stop($result);
|
22
30
|
}
|
23
31
|
|
24
|
-
|
32
|
+
/// Assert that a parameter is `false`
|
33
|
+
/// @access public
|
34
|
+
/// @group testing
|
35
|
+
/// @param {*} $assert - Assert
|
36
|
+
/// @param {String} $description [''] - Assert description
|
37
|
+
/// @require {mixin} _true-fail-details
|
38
|
+
/// @require {mixin} _true-assert-start
|
39
|
+
/// @require {mixin} _true-assert-stop
|
25
40
|
@mixin assert-false(
|
26
41
|
$assert,
|
27
42
|
$description: ''
|
@@ -41,7 +56,15 @@
|
|
41
56
|
@include _true-assert-stop($result);
|
42
57
|
}
|
43
58
|
|
44
|
-
|
59
|
+
/// /// Assert that two parameters are `equal`
|
60
|
+
/// @access public
|
61
|
+
/// @group testing
|
62
|
+
/// @param {*} $assert - Assert
|
63
|
+
/// @param {*} $expected - Expected result
|
64
|
+
/// @param {String} $description [''] - Assert description
|
65
|
+
/// @require {mixin} _true-fail-details
|
66
|
+
/// @require {mixin} _true-assert-start
|
67
|
+
/// @require {mixin} _true-assert-stop
|
45
68
|
@mixin assert-equal(
|
46
69
|
$assert,
|
47
70
|
$expected,
|
@@ -62,7 +85,15 @@
|
|
62
85
|
@include _true-assert-stop($result);
|
63
86
|
}
|
64
87
|
|
65
|
-
|
88
|
+
/// Assert that two parameters are `unequal`
|
89
|
+
/// @access public
|
90
|
+
/// @group testing
|
91
|
+
/// @param {*} $assert - Assert
|
92
|
+
/// @param {*} $expected - Expected result
|
93
|
+
/// @param {String} $description [''] - Assert description
|
94
|
+
/// @require {mixin} _true-fail-details
|
95
|
+
/// @require {mixin} _true-assert-start
|
96
|
+
/// @require {mixin} _true-assert-stop
|
66
97
|
@mixin assert-unequal(
|
67
98
|
$assert,
|
68
99
|
$expected,
|
@@ -87,6 +118,14 @@
|
|
87
118
|
// CSS Output Tests
|
88
119
|
// ----------------
|
89
120
|
|
121
|
+
/// Define a CSS-output assertion
|
122
|
+
/// @access public
|
123
|
+
/// @group testing
|
124
|
+
/// @param {String} $description - Assert description
|
125
|
+
/// @content Use `input()` and `expect()` mixins to define blocks for comparison
|
126
|
+
/// @require {mixin} _true-assert-start
|
127
|
+
/// @require {mixin} _true-assert-stop
|
128
|
+
/// @require {function} _true-selector
|
90
129
|
@mixin assert(
|
91
130
|
$description
|
92
131
|
) {
|
@@ -99,12 +138,20 @@
|
|
99
138
|
@include _true-assert-stop(output-to-css);
|
100
139
|
}
|
101
140
|
|
141
|
+
/// Describe the test content to be evaluated
|
142
|
+
/// The output will be compared against the results of the `expect()` mixin.
|
143
|
+
/// @access public
|
144
|
+
/// @group testing
|
102
145
|
@mixin input {
|
103
146
|
.input {
|
104
147
|
@content;
|
105
148
|
}
|
106
149
|
}
|
107
150
|
|
151
|
+
/// Describe the output content to be expected.
|
152
|
+
/// The output will be compared against the results of the `input()` mixin.
|
153
|
+
/// @access public
|
154
|
+
/// @group testing
|
108
155
|
@mixin expect {
|
109
156
|
.expect {
|
110
157
|
@content;
|
@@ -115,12 +162,23 @@
|
|
115
162
|
// Assert Start
|
116
163
|
// ------------
|
117
164
|
|
165
|
+
/// True assert start helper
|
166
|
+
/// @access private
|
167
|
+
/// @group x_private
|
168
|
+
/// @param {String} $name - Assert name
|
169
|
+
/// @require {mixin} _true-context
|
118
170
|
@mixin _true-assert-start(
|
119
171
|
$name
|
120
172
|
) {
|
121
173
|
@include _true-context(assert, $name);
|
122
174
|
}
|
123
175
|
|
176
|
+
/// True assert sort helper
|
177
|
+
/// @access private
|
178
|
+
/// @group x_private
|
179
|
+
/// @param {String} $result - Assert result
|
180
|
+
/// @require {mixin} _true-context
|
181
|
+
/// @require {mixin} _true-update
|
124
182
|
@mixin _true-assert-stop(
|
125
183
|
$result
|
126
184
|
) {
|
@@ -132,6 +190,14 @@
|
|
132
190
|
// Details
|
133
191
|
// -------
|
134
192
|
|
193
|
+
/// Fail details
|
194
|
+
/// @access private
|
195
|
+
/// @group x_private
|
196
|
+
/// @param {*} $expected - Expected result
|
197
|
+
/// @param {*} $returned - Returned result
|
198
|
+
/// @param {Bool} $terminal [$true-terminal-output] - Whether or not to use terminal output
|
199
|
+
/// @require $true-terminal-output
|
200
|
+
/// @require {function} _true-context
|
135
201
|
@mixin _true-fail-details(
|
136
202
|
$expected,
|
137
203
|
$returned,
|
@@ -140,15 +206,15 @@
|
|
140
206
|
$expected-type: type-of($expected);
|
141
207
|
$returned-type: type-of($returned);
|
142
208
|
|
143
|
-
-expected--#{$expected-type}:
|
144
|
-
-returned--#{$returned-type}:
|
209
|
+
-expected--#{$expected-type}: inspect($expected);
|
210
|
+
-returned--#{$returned-type}: inspect($returned);
|
145
211
|
|
146
212
|
@if $terminal {
|
147
213
|
@debug '[FAIL] #{_true-context(test)} » #{_true-context(assert)}';
|
148
214
|
@debug 'Expected #{$expected-type} »';
|
149
|
-
@debug
|
215
|
+
@debug inspect($expected);
|
150
216
|
@debug 'Returned #{$returned-type} »';
|
151
|
-
@debug
|
217
|
+
@debug inspect($returned);
|
152
218
|
}
|
153
219
|
|
154
220
|
@warn '#{_true-context(test)} » #{_true-context(assert)}';
|
data/sass/true/_messages.scss
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
// Messages
|
2
2
|
// ========
|
3
3
|
|
4
|
-
|
4
|
+
/// New line helper
|
5
|
+
/// @access private
|
6
|
+
/// @group x_private
|
7
|
+
/// @type String
|
8
|
+
$-tnl: '\a ';
|
5
9
|
|
6
10
|
|
7
|
-
|
11
|
+
/// Return a CSS selector for the current context
|
12
|
+
/// @access private
|
13
|
+
/// @group x_private
|
14
|
+
/// @param {List} $scope - Scope
|
15
|
+
/// @require {function} _true-context
|
16
|
+
/// @return {String} - CSS selector
|
8
17
|
@function _true-selector(
|
9
18
|
$scope
|
10
19
|
) {
|
@@ -19,14 +28,22 @@ $-tnl: "\a ";
|
|
19
28
|
}
|
20
29
|
|
21
30
|
|
22
|
-
|
31
|
+
/// Output a spacer comment
|
32
|
+
/// @access private
|
33
|
+
/// @group x_private
|
34
|
+
/// @output A spacer comment
|
23
35
|
@mixin _true-spacer() {
|
24
36
|
/*
|
25
37
|
*/
|
26
38
|
}
|
27
39
|
|
28
40
|
|
29
|
-
|
41
|
+
/// Output a message to CSS comments, or command line terminal (via debug/warn)
|
42
|
+
/// @access private
|
43
|
+
/// @group x_private
|
44
|
+
/// @param {String} $message - Message to output
|
45
|
+
/// @param {String} $output [comments] - Type of output, either `comments`, `terminal`, `debug` or `warn`
|
46
|
+
/// @require {function} _true-str-split
|
30
47
|
@mixin _true-message(
|
31
48
|
$message,
|
32
49
|
$output: comments
|
data/sass/true/_modules.scss
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
// Test Module
|
2
2
|
// ===========
|
3
3
|
|
4
|
-
|
4
|
+
/// Define a Test Module
|
5
|
+
/// @access public
|
6
|
+
/// @group testing
|
7
|
+
/// @param {String} $name - Module name
|
8
|
+
/// @require {mixin} _true-module-start
|
9
|
+
/// @require {mixin} _true-module-stop
|
10
|
+
/// @content Include all the tests that are part of this module
|
5
11
|
@mixin test-module(
|
6
12
|
$name
|
7
13
|
) {
|
@@ -14,6 +20,13 @@
|
|
14
20
|
// Module Start (private)
|
15
21
|
// ----------------------
|
16
22
|
|
23
|
+
/// Module start helper
|
24
|
+
/// @access private
|
25
|
+
/// @group x_private
|
26
|
+
/// @param {String} $name - Module name
|
27
|
+
/// @require {mixin} _true-reset
|
28
|
+
/// @require {mixin} _true-context
|
29
|
+
/// @require {mixin} _true-message
|
17
30
|
@mixin _true-module-start(
|
18
31
|
$name
|
19
32
|
) {
|
@@ -26,6 +39,12 @@
|
|
26
39
|
// Module Stop (private)
|
27
40
|
// ---------------------
|
28
41
|
|
42
|
+
/// Module stop helper
|
43
|
+
/// @access private
|
44
|
+
/// @group x_private
|
45
|
+
/// @require {mixin} _true-reset
|
46
|
+
/// @require {mixin} _true-context
|
47
|
+
/// @require {mixin} _true-message
|
29
48
|
@mixin _true-module-stop {
|
30
49
|
@include _true-update(global, null);
|
31
50
|
@include _true-reset(module);
|
data/sass/true/_results.scss
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
// Results
|
2
2
|
// =======
|
3
3
|
|
4
|
+
/// Initialized results map
|
5
|
+
/// @access private
|
6
|
+
/// @group x_private
|
7
|
+
/// @type Map
|
4
8
|
$_true-results-reset: (
|
5
9
|
run: 0,
|
6
10
|
pass: 0,
|
@@ -8,6 +12,14 @@ $_true-results-reset: (
|
|
8
12
|
output-to-css: 0,
|
9
13
|
);
|
10
14
|
|
15
|
+
/// Results map
|
16
|
+
/// @access private
|
17
|
+
/// @group x_private
|
18
|
+
/// @type Map
|
19
|
+
/// @require $_true-results-reset
|
20
|
+
/// @prop {Map} global [$_true-results-reset] - Global results
|
21
|
+
/// @prop {Map} module [$_true-results-reset] - Results for current module
|
22
|
+
/// @prop {Map} test [$_true-results-reset] - Results for current test
|
11
23
|
$_true-results: (
|
12
24
|
global: $_true-results-reset,
|
13
25
|
module: $_true-results-reset,
|
@@ -18,6 +30,12 @@ $_true-results: (
|
|
18
30
|
// Reset
|
19
31
|
// -----
|
20
32
|
|
33
|
+
/// Reset helper
|
34
|
+
/// @access private
|
35
|
+
/// @group x_private
|
36
|
+
/// @param {String} $scope - Scope to reset
|
37
|
+
/// @require $_true-results-reset
|
38
|
+
/// @require $_true-results
|
21
39
|
@mixin _true-reset(
|
22
40
|
$scope
|
23
41
|
) {
|
@@ -47,6 +65,11 @@ $_true-results: (
|
|
47
65
|
// Get Results
|
48
66
|
// -----------
|
49
67
|
|
68
|
+
/// Results getter
|
69
|
+
/// @access private
|
70
|
+
/// @group x_private
|
71
|
+
/// @param {String} $scope - Scope to get results from
|
72
|
+
/// @require $_true-results
|
50
73
|
@function _true-get-results(
|
51
74
|
$scope
|
52
75
|
) {
|
@@ -57,6 +80,11 @@ $_true-results: (
|
|
57
80
|
// Get Result
|
58
81
|
// ----------
|
59
82
|
|
83
|
+
/// Single result getter
|
84
|
+
/// @access private
|
85
|
+
/// @group x_private
|
86
|
+
/// @param {String} $scope - Scope to get result form
|
87
|
+
/// @require {function} _true-get-results
|
60
88
|
@function _true-get-result(
|
61
89
|
$scope
|
62
90
|
) {
|
@@ -76,6 +104,14 @@ $_true-results: (
|
|
76
104
|
// Update
|
77
105
|
// ------
|
78
106
|
|
107
|
+
/// Update results
|
108
|
+
/// @access private
|
109
|
+
/// @group x_private
|
110
|
+
/// @param {String} $scope - Scope to update results from
|
111
|
+
/// @param {List} $results - Results
|
112
|
+
/// @require {function} _true-get-results
|
113
|
+
/// @require {function} _true-map-increment
|
114
|
+
/// @require $_true-results
|
79
115
|
@mixin _true-update(
|
80
116
|
$scope,
|
81
117
|
$results
|
@@ -101,6 +137,13 @@ $_true-results: (
|
|
101
137
|
// Report Message
|
102
138
|
// --------------
|
103
139
|
|
140
|
+
/// Report message
|
141
|
+
/// @access private
|
142
|
+
/// @group x_private
|
143
|
+
/// @param {String} $scope [test] - Scope
|
144
|
+
/// @param {String} $lines [single] - Lines
|
145
|
+
/// @return {String} - Reported message
|
146
|
+
/// @require {function} _true-get-results
|
104
147
|
@function _true-report-message(
|
105
148
|
$scope: test,
|
106
149
|
$lines: single
|
@@ -135,6 +178,12 @@ $_true-results: (
|
|
135
178
|
// Report
|
136
179
|
// ------
|
137
180
|
|
181
|
+
/// Report results summary to CSS and/or command line
|
182
|
+
/// @access public
|
183
|
+
/// @group reporting
|
184
|
+
/// @param {Bool} $terminal [$true-terminal-output] - Whether or not to use terminal output
|
185
|
+
/// @require {function} _true-report-message
|
186
|
+
/// @require {function} _true-message
|
138
187
|
@mixin report(
|
139
188
|
$terminal: $true-terminal-output
|
140
189
|
) {
|
data/sass/true/_settings.scss
CHANGED
@@ -1,18 +1,35 @@
|
|
1
1
|
// True Settings
|
2
2
|
// =============
|
3
3
|
|
4
|
+
/// Whether or not to use the terminal as output stream
|
5
|
+
/// @access public
|
6
|
+
/// @group reporting
|
7
|
+
/// @type Bool
|
4
8
|
$true-terminal-output: true !default;
|
5
9
|
|
6
10
|
|
7
11
|
// Context (private)
|
8
12
|
// -----------------
|
9
13
|
|
14
|
+
/// True current context
|
15
|
+
/// @access private
|
16
|
+
/// @group x_private
|
17
|
+
/// @type Map
|
18
|
+
/// @prop {String} module [null]
|
19
|
+
/// @prop {String} test [null]
|
20
|
+
/// @prop {String} assert [null]
|
10
21
|
$_true-context: (
|
11
22
|
module: null,
|
12
23
|
test: null,
|
13
24
|
assert: null,
|
14
25
|
);
|
15
26
|
|
27
|
+
/// Update the current context
|
28
|
+
/// @access private
|
29
|
+
/// @group x_private
|
30
|
+
/// @param {String} $scope - Either `module`, `test` or `assert`
|
31
|
+
/// @param {String} $name - Name of current scope
|
32
|
+
/// @require $_true-context
|
16
33
|
@mixin _true-context(
|
17
34
|
$scope,
|
18
35
|
$name
|
@@ -20,6 +37,11 @@ $_true-context: (
|
|
20
37
|
$_true-context: map-merge($_true-context, ($scope: $name)) !global;
|
21
38
|
}
|
22
39
|
|
40
|
+
/// Get information on current context
|
41
|
+
/// @access private
|
42
|
+
/// @group x_private
|
43
|
+
/// @param {String} $scope - Either `module`, `test` or `assert`
|
44
|
+
/// @return {String}
|
23
45
|
@function _true-context(
|
24
46
|
$scope
|
25
47
|
) {
|
data/sass/true/_tests.scss
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
// Tests
|
2
2
|
// =====
|
3
3
|
|
4
|
-
|
4
|
+
/// Describe a Test
|
5
|
+
/// @access public
|
6
|
+
/// @group testing
|
7
|
+
/// @param {String} $name - Test bame
|
8
|
+
/// @require {mixin}_true-test-start
|
9
|
+
/// @require {mixin}_true-test-stop
|
10
|
+
/// @require {function} _true-selector
|
11
|
+
/// @content Include the assertions that are part of this test
|
5
12
|
@mixin test(
|
6
13
|
$name
|
7
14
|
) {
|
@@ -17,6 +24,13 @@
|
|
17
24
|
// Module Start (private)
|
18
25
|
// ----------------------
|
19
26
|
|
27
|
+
/// Test start helper
|
28
|
+
/// @access private
|
29
|
+
/// @group x_private
|
30
|
+
/// @param {String} $name - Test name
|
31
|
+
/// @require {mixin} _true-reset
|
32
|
+
/// @require {mixin} _true-context
|
33
|
+
/// @require {mixin} _true-message
|
20
34
|
@mixin _true-test-start(
|
21
35
|
$name
|
22
36
|
) {
|
@@ -29,6 +43,13 @@
|
|
29
43
|
// Module Stop (private)
|
30
44
|
// ---------------------
|
31
45
|
|
46
|
+
/// Test stop helper
|
47
|
+
/// @access private
|
48
|
+
/// @group x_private
|
49
|
+
/// @require {mixin} _true-reset
|
50
|
+
/// @require {mixin} _true-context
|
51
|
+
/// @require {mixin} _true-message
|
52
|
+
/// @require {function} _true-get-result
|
32
53
|
@mixin _true-test-stop {
|
33
54
|
@include _true-update(module, _true-get-result(test));
|
34
55
|
@include _true-reset(test);
|
data/sass/true/_utilities.scss
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
// Utilities
|
2
2
|
// =========
|
3
3
|
|
4
|
-
|
4
|
+
/// Add map values together
|
5
|
+
/// @access private
|
6
|
+
/// @group x_private
|
7
|
+
/// @param {Map} $base - Initial map
|
8
|
+
/// @param {Map} $add - Extra map
|
9
|
+
/// @return {Map}
|
5
10
|
@function _true-map-increment(
|
6
11
|
$base,
|
7
12
|
$add
|
@@ -19,7 +24,12 @@
|
|
19
24
|
@return $base;
|
20
25
|
}
|
21
26
|
|
22
|
-
|
27
|
+
/// Split a string
|
28
|
+
/// @access private
|
29
|
+
/// @group x_private
|
30
|
+
/// @param {String} $string - String to split
|
31
|
+
/// @param {String} $substring - Delimiter
|
32
|
+
/// @return {List} - `$string` fragments
|
23
33
|
@function _true-str-split(
|
24
34
|
$string,
|
25
35
|
$substring
|
@@ -36,7 +46,12 @@
|
|
36
46
|
}
|
37
47
|
|
38
48
|
|
39
|
-
|
49
|
+
/// Check for strict equality
|
50
|
+
/// @access private
|
51
|
+
/// @group x_private
|
52
|
+
/// @param {*} $one - First value
|
53
|
+
/// @param {*} $two - Second value
|
54
|
+
/// @return {Bool}
|
40
55
|
@function _true-is-equal($one, $two) {
|
41
56
|
@if type-of($one) == number and type-of($two) == number {
|
42
57
|
@if unit($one) == unit($two) {
|