Created
May 31, 2016 10:30
-
-
Save skial/fa4537fc859d4980317ebf74bbd20209 to your computer and use it in GitHub Desktop.
From https://github.com/HaxeFoundation/haxe/blob/90ed3fdbf28f23fe820db8f9a20629901c3c5ffd/tests/unit/src/unit/issues/Issue4862.hx. Copied for easier embedding.
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
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); | |
t(switch (a) { case HttpStatus.Ok: true; default: false; }); | |
t(switch (b) { case HttpStatus.NotFound: true; default: false; }); | |
t(switch (a) { case Ok: true; default: false; }); | |
t(switch (b) { case NotFound: true; default: false; }); | |
} | |
#end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment