Skip to content

Instantly share code, notes, and snippets.

@skial
Created May 31, 2016 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skial/fa4537fc859d4980317ebf74bbd20209 to your computer and use it in GitHub Desktop.
Save skial/fa4537fc859d4980317ebf74bbd20209 to your computer and use it in GitHub Desktop.
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