Browse Source

add test for #4862

Dan Korostelev 9 years ago
parent
commit
d35b3f15b2
1 changed files with 27 additions and 0 deletions
  1. 27 0
      tests/unit/src/unit/issues/Issue4862.hx

+ 27 - 0
tests/unit/src/unit/issues/Issue4862.hx

@@ -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
+}