-
-
Notifications
You must be signed in to change notification settings - Fork 661
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package unit.issues; | ||
|
||
#if js | ||
@:native("__issue4862__http_status") | ||
@:enum private extern abstract HttpStatus(Int) to Int { | ||
var Ok; | ||
var NotFound; | ||
|
||
static function __init__():Void { | ||
untyped __js__("var __issue4862__http_status = {Ok: 200, NotFound: 404};"); | ||
} | ||
} | ||
#end | ||
|
||
class Issue4862 extends Test { | ||
#if js | ||
function test() { | ||
var a = Ok; | ||
eq(200, a); | ||
var b = HttpStatus.NotFound; | ||
eq(404, b); | ||
// TODO: support unqualified matching | ||
t(switch (a) { case HttpStatus.Ok: true; default: false; }); | ||
t(switch (b) { case HttpStatus.NotFound: true; default: false; }); | ||
} | ||
#end | ||
} |