Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

more test of var cast builtin

  • Loading branch information...
commit b6e861c7a8aee6d118677848f4e045107fe1ca1e 1 parent 4f1fbbb
NotFound authored

Showing 1 changed file with 20 additions and 1 deletion. Show diff stats Hide diff stats

  1. +20 1 t/advanced/02varcast.t
21 t/advanced/02varcast.t
@@ -6,9 +6,28 @@ $load 'Test/More.pbc';
6 6
7 7 function main()
8 8 {
9   - var (Test.More.plan)(1);
  9 + var (Test.More.plan)(3);
10 10
11 11 var (Test.More.ok)(1, "cast to var avoid parse as method call");
  12 +
  13 + var is = var (Test.More.is);
  14 + is(1, 1, "cast to var gets symbols not in scope");
  15 +
  16 + var foo = new Foo("Hello");
  17 + is(foo.get(), "Hello", "cast to var with self avoid parse as method call");
  18 +}
  19 +
  20 +class Foo
  21 +{
  22 + var fn;
  23 + function Foo(string s)
  24 + {
  25 + self.fn = function () { return s; };
  26 + }
  27 + function get()
  28 + {
  29 + return var (self.fn)();
  30 + }
12 31 }
13 32
14 33 // End

0 comments on commit b6e861c

Please sign in to comment.
Something went wrong with that request. Please try again.