TestPhp.hx 688 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package unit;
  2. class TestPhp extends Test
  3. {
  4. var list : Array<Dynamic>;
  5. var list2 : Array<Dynamic>;
  6. function empty() return true;
  7. function testAbstractEnum()
  8. {
  9. eq(Abstract.getName(), "Abstract");
  10. var x = Const("foo");
  11. var s = switch(x) {
  12. case Const(s): s;
  13. case Abstract: "null";
  14. }
  15. eq("foo", s);
  16. }
  17. function testAbstractKeywordAsFunction()
  18. {
  19. t(empty());
  20. }
  21. function testList2()
  22. {
  23. list2 = new Array<Dynamic>();
  24. for( l in list2 ) {} // fails here
  25. t(true);
  26. }
  27. function testList()
  28. {
  29. list = new Array<Dynamic>();
  30. for( l in list ) {} // fails here
  31. t(true);
  32. }
  33. }
  34. enum Annotation {
  35. Abstract;
  36. Const(i:String);
  37. }