Skip to content

Commit

Permalink
add test for #4862
Browse files Browse the repository at this point in the history
  • Loading branch information
nadako committed Feb 20, 2016
1 parent 10e888a commit d35b3f1
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/unit/src/unit/issues/Issue4862.hx
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
}

0 comments on commit d35b3f1

Please sign in to comment.