true 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ True Changelog
2
+ ==============
3
+
4
+ 0.1.0 (6/6/13)
5
+ --------------
6
+ - `assert-true()`, `assert-false()`, `assert-equal()`, and `assert-unequal()`.
7
+ - `pass()` and `fail()` for tracking and reporting individual results.
8
+ - `start-test-module()` and `report-test-results()` for module results.
9
+ - Includes tests of the testing tools!
data/LICENSE.txt ADDED
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2013, Eric Meyer
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above
11
+ copyright notice, this list of conditions and the following
12
+ disclaimer in the documentation and/or other materials provided
13
+ with the distribution.
14
+ * Neither the name of the author nor the names of other
15
+ contributors may be used to endorse or promote products derived
16
+ from this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ True
2
+ ====
3
+
4
+ A testing framework for compass/sass libraries.
data/lib/true.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'compass'
2
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
3
+ Compass::Frameworks.register('true', :path => extension_path)
data/sass/_true.scss ADDED
@@ -0,0 +1,6 @@
1
+ // Susy partials
2
+ // =============
3
+
4
+ @import "true/modules";
5
+ @import "true/messages";
6
+ @import "true/assert";
@@ -0,0 +1,32 @@
1
+ // Assert
2
+ // ======
3
+
4
+ @mixin assert-true(
5
+ $test
6
+ ) {
7
+ @if $test { @include pass; }
8
+ @else { @include fail('#{$test} is not true.'); }
9
+ }
10
+
11
+ @mixin assert-false(
12
+ $test
13
+ ) {
14
+ @if not $test { @include pass; }
15
+ @else { @include fail('#{$test} is not false.'); }
16
+ }
17
+
18
+ @mixin assert-equal(
19
+ $test,
20
+ $expected
21
+ ) {
22
+ @if $test == $expected { @include pass; }
23
+ @else { @include fail('#{$test} != #{$expected}'); }
24
+ }
25
+
26
+ @mixin assert-unequal(
27
+ $test,
28
+ $expected
29
+ ) {
30
+ @if $test != $expected { @include pass; }
31
+ @else { @include fail('#{$test} == #{$expected}'); }
32
+ }
@@ -0,0 +1,19 @@
1
+ // Pass / Fail Messages
2
+ // ====================
3
+
4
+ $test-pass-message : '.' !default;
5
+ $test-fail-message : 'F' !default;
6
+
7
+ @mixin pass(
8
+ $pass: $test-pass-message
9
+ ) {
10
+ $test-results: append($test-results, 'p');
11
+ @debug $pass;
12
+ }
13
+
14
+ @mixin fail(
15
+ $fail: $test-fail-message
16
+ ) {
17
+ $test-results: append($test-results, 'f');
18
+ @warn $fail;
19
+ }
@@ -0,0 +1,52 @@
1
+ // Test Modules
2
+ // ============
3
+
4
+ $test-results: null;
5
+ $test-module-name: null;
6
+
7
+ // Establish a new test module
8
+ @mixin start-test-module(
9
+ $name
10
+ ) {
11
+ $test-results: compact();
12
+ $test-module-name: $name;
13
+ }
14
+
15
+ // Collate test results
16
+ @function collate-results(
17
+ $results: $test-results
18
+ ) {
19
+ $total: length($results);
20
+ $pass: 0;
21
+ $fail: 0;
22
+
23
+ @each $test in $results {
24
+ @if $test == 'p' { $pass: $pass + 1; }
25
+ @if $test == 'f' { $fail: $fail + 1; }
26
+ }
27
+
28
+ @return $total $pass $fail;
29
+ }
30
+
31
+ // Report the results of the module
32
+ @mixin report-test-results(
33
+ $name: $test-module-name,
34
+ $results: $test-results
35
+ ) {
36
+ $results: collate-results($results);
37
+ $total: nth($results, 1);
38
+ $pass: nth($results, 2);
39
+ $fail: nth($results, 3);
40
+
41
+ @if $name {
42
+ $result-message: '#{$name}: Passed #{$pass} of #{$total} (#{$fail} tests failed)';
43
+ /* #{$result-message} #{if($fail > 0, '************', null)}*/
44
+ @debug $result-message;
45
+ } @else {
46
+ @warn 'Remember to start your test module.';
47
+ }
48
+
49
+ // End module
50
+ $test-results: null;
51
+ $test-module-name: null;
52
+ }
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: "true"
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Eric Meyer
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-06-05 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: compass
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 43
29
+ segments:
30
+ - 0
31
+ - 12
32
+ - 2
33
+ version: 0.12.2
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: sass
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 15
45
+ segments:
46
+ - 3
47
+ - 2
48
+ - 0
49
+ version: 3.2.0
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ description: A framework to help you develop and manage compass/sass libraries with a test-driven approach.
53
+ email:
54
+ - eric@oddbird.net
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files:
60
+ - CHANGELOG.md
61
+ - LICENSE.txt
62
+ - README.md
63
+ - lib/true.rb
64
+ files:
65
+ - lib/true.rb
66
+ - sass/_true.scss
67
+ - sass/true/_assert.scss
68
+ - sass/true/_messages.scss
69
+ - sass/true/_modules.scss
70
+ - CHANGELOG.md
71
+ - LICENSE.txt
72
+ - README.md
73
+ homepage: http://oddbird.net/
74
+ licenses: []
75
+
76
+ post_install_message:
77
+ rdoc_options:
78
+ - --line-numbers
79
+ - --inline-source
80
+ - --title
81
+ - "true"
82
+ - --main
83
+ - README.md
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 11
101
+ segments:
102
+ - 1
103
+ - 2
104
+ version: "1.2"
105
+ requirements: []
106
+
107
+ rubyforge_project: "true"
108
+ rubygems_version: 1.8.24
109
+ signing_key:
110
+ specification_version: 3
111
+ summary: Testing framework for compass and sass libraries.
112
+ test_files: []
113
+