-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not include this code into master, this needs to be refactored when
- Loading branch information
Showing
21 changed files
with
199 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
import ceylon.language.meta.model { | ||
|
||
Value | ||
} | ||
|
||
|
||
"Thrown when compleation of an object can't be done" | ||
shared class CompleationException extends Exception { | ||
|
||
shared Value<> offendingValue; | ||
shared new nonLateOrVariable(Value<> offendingValue) extends Exception("Counldn't compleate ``offendingValue``, it is not marked as late or variable. ") { | ||
this.offendingValue=offendingValue; | ||
} | ||
shared new allreadyCompleated(Value<> offendingValue) extends Exception("Couldn't compleate ``offendingValue``, it is allready assigned and it's not a variable to be reasinged") { | ||
this.offendingValue=offendingValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import herd.depin.core { | ||
CompleationException | ||
} | ||
|
||
import ceylon.language.meta.model { | ||
Value | ||
} | ||
|
||
|
||
|
||
throws (`class CompleationException`) | ||
shared void compleate(Value<> val, Anything compleationValue) { | ||
|
||
if(val.declaration.late ||val.declaration.variable){ | ||
try{ | ||
val.setIfAssignable(compleationValue); | ||
}catch(InitializationError x){ | ||
throw CompleationException.allreadyCompleated(val); | ||
} | ||
}else{ | ||
throw CompleationException.nonLateOrVariable(val); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import ceylon.test { | ||
|
||
test, | ||
ignore | ||
} | ||
|
||
|
||
|
||
class TestClass(){ | ||
shared late String attr; | ||
} | ||
ignore | ||
shared test void checkMemberSet(){ | ||
|
||
|
||
value test=TestClass(); | ||
value val=`value TestClass.attr`; | ||
val.memberSet(test, "bleh"); | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
test/test/herd/depin/engine/integration/SunnyCompleationTest.ceylon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import ceylon.test { | ||
testExtension, | ||
test | ||
} | ||
import depin.test.extension { | ||
LoggingTestExtension | ||
} | ||
import test.herd.depin.engine.integration.compleation { | ||
PositiveCompleation | ||
} | ||
import herd.depin.core { | ||
Depin | ||
} | ||
|
||
testExtension (`class LoggingTestExtension`) | ||
shared class SunnyCompleationTest() { | ||
|
||
shared test | ||
void shouldCompleateJohnDependency() { | ||
|
||
value target = PositiveCompleation(); | ||
Depin({ `value fixture.person.john` }).compleate(target); | ||
assert (target.john == fixture.person.john); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
test/test/herd/depin/engine/integration/compleation/AllreadyCompleatedCompleation.ceylon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import herd.depin.core { | ||
|
||
compleatable | ||
} | ||
import test.herd.depin.engine.integration.injection { | ||
|
||
Person | ||
} | ||
|
||
shared class AllreadyCompleatedCompleation(Person bleh) { | ||
shared compleatable late Person john=bleh; | ||
} |
10 changes: 10 additions & 0 deletions
10
test/test/herd/depin/engine/integration/compleation/NonLateNegativeCompleation.ceylon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import herd.depin.core { | ||
|
||
compleatable | ||
} | ||
import test.herd.depin.engine.integration.injection { | ||
|
||
Person | ||
} | ||
shared class NonLateNegativeCompleation(shared compleatable Person john) { | ||
} |
13 changes: 13 additions & 0 deletions
13
test/test/herd/depin/engine/integration/compleation/PositiveCompleation.ceylon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import test.herd.depin.engine.integration.injection { | ||
|
||
Person | ||
} | ||
import herd.depin.core { | ||
|
||
compleatable | ||
} | ||
shared class PositiveCompleation() { | ||
|
||
shared compleatable late Person john; | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
test/test/herd/depin/engine/integration/compleation/package.ceylon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shared package test.herd.depin.engine.integration.compleation; |