-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for toplevel late values for #37
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...ompiler/resource/test/com/vasileff/ceylon/dart/compiler/values/toplevelLateValues.tceylon
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,11 @@ | ||
late String late1; | ||
late variable String late2; | ||
|
||
shared void run() { | ||
late1 = "late1"; | ||
late2 = "late2"; | ||
assert (late1 == "late1"); | ||
assert (late2 == "late2"); | ||
late2 = "late2b"; | ||
assert (late2 == "late2b"); | ||
} |
56 changes: 56 additions & 0 deletions
56
...-compiler/resource/test/com/vasileff/ceylon/dart/compiler/values/toplevelLateValues.tdart
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,56 @@ | ||
import "dart:core" as $dart$core; | ||
import "package:ceylon/interop/dart/dart.dart" as $ceylon$interop$dart; | ||
import "package:ceylon/dart/runtime/model/model.dart" as $ceylon$dart$runtime$model; | ||
import "package:ceylon/language/language.dart" as $ceylon$language; | ||
|
||
$dart$core.String $package$$late1; | ||
|
||
$dart$core.String get $late1 => $package$$late1; | ||
|
||
$dart$core.String $package$$late2; | ||
|
||
$dart$core.String get $late2 => $package$$late2; | ||
|
||
set $late2($dart$core.String value) => $package$$late2 = value; | ||
|
||
void $package$$run() { | ||
$package$$late1 = "late1"; | ||
$package$$late2 = "late2"; | ||
if (!($package$$late1 == "late1")) { | ||
throw new $ceylon$language.AssertionError("Violated: late1 == \"late1\""); | ||
} | ||
if (!($package$$late2 == "late2")) { | ||
throw new $ceylon$language.AssertionError("Violated: late2 == \"late2\""); | ||
} | ||
$package$$late2 = "late2b"; | ||
if (!($package$$late2 == "late2b")) { | ||
throw new $ceylon$language.AssertionError("Violated: late2 == \"late2b\""); | ||
} | ||
} | ||
|
||
void $run() => $package$$run(); | ||
|
||
$ceylon$language.dart$Callable _$runToplevel = new $ceylon$language.dart$Callable(($ceylon$language.String toplevel) { | ||
switch (toplevel.toString()) { | ||
case "run" : | ||
$package$$run(); | ||
return $ceylon$language.$true; | ||
} | ||
return $ceylon$language.$false; | ||
}); | ||
|
||
const _$jsonModel = const{"\$mod-name":"default","\$mod-version":"unversioned","":const{}}; | ||
|
||
var _$module = null; | ||
|
||
get $module { | ||
if (_$module == null) { | ||
_$module = new $ceylon$dart$runtime$model.json$LazyJsonModule(new $ceylon$interop$dart.JsonObject(_$jsonModel), _$runToplevel); | ||
_$module.initializeImports((new $ceylon$interop$dart.CeylonIterable([$ceylon$language.$module])).sequence()); | ||
} | ||
return _$module; | ||
} | ||
|
||
void main($dart$core.List arguments) { | ||
$ceylon$language.$run(arguments, $module); | ||
} |
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