/t/classtest.t

http://github.com/NotFound/winxed · Raku · 40 lines · 33 code · 6 blank · 1 comment · 2 complexity · 2fadb7d5e5ae91454bd8306e9686d2c6 MD5 · raw file

  1. #! winxed
  2. // Mininal tests of class
  3. using extern Test.More plan, ok;
  4. class Foo
  5. {
  6. function num () { return 1; }
  7. function do()
  8. {
  9. ok(1);
  10. }
  11. }
  12. class Bar
  13. {
  14. function num () { return 2; }
  15. function do()
  16. {
  17. ok(1);
  18. ok(1);
  19. }
  20. }
  21. function main()
  22. {
  23. var tests = [ new Foo, new Bar ];
  24. var t;
  25. int total= 0;
  26. for (t in tests)
  27. {
  28. total = total + t.num();
  29. }
  30. plan(total);
  31. for (t in tests)
  32. t.do();
  33. }
  34. // End