Split long lines
[gnash.git] / testsuite / as3compile.all / lookup.as
blobc333ad3ed3b7b281a2c601469f781115c5b8d6b3
1 //
2 // Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
3 // Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include "check.as"
21 package p1 {
22 public class A { public function id() { return "p1.A"; } }
23 public class B { public static function id() { return "p1.B"; } }
26 package p2 {
27 public class A { public function id() { return "p2.A"; } }
28 public class B { public static function id() { return "p2.B"; } }
29 public class C {}
32 package main {
34 import flash.display.MovieClip;
36 public class Main extends MovieClip {
38 DEJAGNU_OBJ;
40 import p1.*;
41 import p2.*;
43 // This is not that hard at all, as the compiler should generate
44 // the code specifying which namespace to look in.
45 public function Main() {
47 var a = new A();
49 // Check that functions work at all...
50 check_equals(typeof(a.id()), "string");
52 // Check non-static function lookup
53 check_equals(a.id(), "p1.A");
55 // Check static function lookup.
56 check_equals(B.id(), "p1.B");
58 done();