Skip to content

Commit 4e7b259

Browse files
committed
Fix AND/OR operations and enable test case
1 parent 0d0f01e commit 4e7b259

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CSS::Sass (3.4.1)
55
* Bundle experimental LibSass plugins (alpha)
66
* Improve command line utility for plugins
77
* Fix tests due to wrong skip count (Perl < 5.12)
8+
* Fix AND/OR operations and enable test case
89

910
-- Marcel Greter <[email protected]> Wed, 11 Jan 2017 14:18:43 +0200
1011

Sass.xs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,8 @@ sass_operation(op, a, b)
962962
default: rv = sass_make_error("invalid op"); break;
963963
}
964964

965-
RETVAL = sass_value_to_sv(rv);
965+
if (rv) RETVAL = sass_value_to_sv(rv);
966+
else RETVAL = new_sv_sass_null();
966967

967968
sass_delete_value(rhs);
968969
sass_delete_value(lhs);

t/10_sass_value_op.t

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ BEGIN {
88
use Test::More;
99
}
1010

11+
use Test::Differences;
1112
use Test::More tests => 40;
1213

1314
BEGIN { use_ok('CSS::Sass') };
@@ -166,13 +167,13 @@ is(
166167
my ($r, $err) = CSS::Sass::sass_compile(
167168
'
168169
@mixin test_comp_op($a, $b) {
169-
// /*! #{inspect(op_and($a, $b))} == #{($a and $b)} */
170-
// test-and: op_and($a, $b) == ($a and $b);
171-
// test-custom: inspect(op_and($a, $b));
170+
/*! #{inspect(op_and($a, $b))} == #{($a and $b)} */
171+
test-and: op_and($a, $b) == ($a and $b);
172+
test-custom: inspect(op_and($a, $b));
172173
test-native: inspect(($a and $b));
173-
// /*! #{inspect(op_or($a, $b))} == #{($a or $b)} */
174-
// test-or: op_or($a, $b) == ($a or $b);
175-
// test-custom: inspect(op_or($a, $b));
174+
/*! #{inspect(op_or($a, $b))} == #{($a or $b)} */
175+
test-or: op_or($a, $b) == ($a or $b);
176+
test-custom: inspect(op_or($a, $b));
176177
test-native: inspect(($a or $b));
177178
/*! #{inspect(op_eq($a, $b))} == #{($a == $b)} */
178179
test-eq: op_eq($a, $b) == ($a == $b);
@@ -256,7 +257,13 @@ my ($r, $err) = CSS::Sass::sass_compile(
256257

257258
my $expected = <<END_OF_EXPECTED;
258259
numbers {
260+
/*! 42 == 42 */
261+
test-and: true;
262+
test-custom: 42;
259263
test-native: 42;
264+
/*! 42px == 42px */
265+
test-or: true;
266+
test-custom: 42px;
260267
test-native: 42px;
261268
/*! true == true */
262269
test-eq: true;
@@ -332,5 +339,5 @@ booleans {
332339
test-native: true/false; }
333340
END_OF_EXPECTED
334341

335-
is ($r, $expected, "big custom operation test");
342+
eq_or_diff ($r, $expected, "big custom operation test");
336343
is ($err, undef, "big custom operation test has no error");

0 commit comments

Comments
 (0)