Skip to content

Commit

Permalink
Added unit tests #186
Browse files Browse the repository at this point in the history
  • Loading branch information
jurcovicovam committed Jun 28, 2014
1 parent f98c552 commit 34df55f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ public Expression evaluate(IndirectVariable input) {
printer.append(reference);
String realName = printer.toString();

Variable realVariable = new Variable(input.getUnderlyingStructure(), "@" + realName);
return evaluate(realVariable);
Variable directVariable = new Variable(input.getUnderlyingStructure(), "@" + realName);
return evaluate(directVariable);
}

public Expression evaluate(Expression input) {
Expand Down Expand Up @@ -207,11 +207,9 @@ public Expression evaluate(Expression input) {
case EMBEDDED_SCRIPT:
return evaluate((EmbeddedScript) input);

//FIXME: !!!!!!!!!!! now, this is probably wrong, just hotefixing prototype
case DETACHED_RULESET:
return evaluate((DetachedRuleset) input);

//the value is already there, nothing to evaluate -- TODO - probably bug, should create clone()
case IDENTIFIER_EXPRESSION:
case COLOR_EXPRESSION:
case NUMBER:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

import org.junit.runners.Parameterized.Parameters;

/*
* TODO: test if @defaults works correctly -- e.g. including various callers scopes
* TODO: test order detached mixin imports who sees who and who overwrites who
* FIXME: !!!!!!!!!!!!! test mixin returned from detached ruleset
*/
public class DetachedRulesetsTest extends BasicFeaturesTest {

private static final String standardCases = "src/test/resources/compile-basic-features/detached-rulesets/";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
.default-mixin-argument {
#basic-case .default-mixin-argument {
default: default;
}
.custom-mixin-argument {
#basic-case .custom-mixin-argument {
custom: custom;
}
#sees-caller-scope .default-mixin-argument {
from-default: sees;
}
#sees-caller-scope .custom-mixin-argument {
from-custom: sees;
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Warnings produced by compilation of testCase
WARNING 1:20 This works, but is incompatible with less.js. Less.js does not allow detached rulesets as default mixin parameter values.
WARNING 2:22 This works, but is incompatible with less.js. Less.js does not allow detached rulesets as default mixin parameter values.
WARNING 16:22 This works, but is incompatible with less.js. Less.js does not allow detached rulesets as default mixin parameter values.
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
.mixin(@parameter: {default: default;}) {
@parameter();
#basic-case {
.mixin(@parameter: {default: default;}) {
@parameter();
}

.default-mixin-argument {
.mixin();
}

.custom-mixin-argument {
.mixin({custom: custom;});
}
}

.default-mixin-argument {
.mixin();
}

.custom-mixin-argument {
.mixin({custom: custom;});
//sees-caller-scope
#sees-caller-scope {
.mixin(@parameter: {.inCaller();}) {
@parameter();
}

.default-mixin-argument {
.inCaller() {
from-default: sees;
}
.mixin();
}

.custom-mixin-argument {
.inCaller() {
from-custom: sees;
}
.mixin({.inCaller();});
}
}

0 comments on commit 34df55f

Please sign in to comment.