Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/mjsunit/harmony/module-linking.js

Issue 9844002: Implement rudimentary module linking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/mjsunit/harmony/module-parsing.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 // Flags: --harmony-modules --harmony-scoping
29
30 // Test basic module linking.
31
32 "use strict";
33
34 let log = "";
35
36 export let x = (log += "1");
37
38 export module B = A.B
39
40 export module A {
41 export let x = (log += "2");
42 let y = (log += "3");
43 export function f() { log += "5" };
44 export module B {
45 module BB = B;
46 export BB, x;
47 let x = (log += "4");
48 f();
49 let y = (log += "6");
50 }
51 export let z = (log += "7");
52 export module C {
53 export let z = (log += "8");
54 export module D = B
55 export module C = A.C
56 }
57 module D {}
58 }
59
60 export module M1 {
61 export module A2 = M2;
62 export let x = (log += "9");
63 }
64 export module M2 {
65 export module A1 = M1;
66 export let x = (log += "0");
67 }
68
69 assertEquals("object", typeof A);
70 assertTrue('x' in A);
71 assertFalse('y' in A);
72 assertTrue('f' in A);
73 assertTrue('B' in A);
74 assertTrue('z' in A);
75 assertTrue('C' in A);
76 assertFalse('D' in A);
77
78 assertEquals("object", typeof B);
79 assertTrue('BB' in B);
80 assertTrue('x' in B);
81 assertFalse('y' in B);
82
83 assertEquals("object", typeof A.B);
84 assertTrue('BB' in A.B);
85 assertTrue('x' in A.B);
86 assertFalse('y' in A.B);
87
88 assertEquals("object", typeof A.B.BB);
89 assertTrue('BB' in A.B.BB);
90 assertTrue('x' in A.B.BB);
91 assertFalse('y' in A.B.BB);
92
93 assertEquals("object", typeof A.C);
94 assertTrue('z' in A.C);
95 assertTrue('D' in A.C);
96 assertTrue('C' in A.C);
97
98 assertEquals("object", typeof M1);
99 assertEquals("object", typeof M2);
100 assertTrue('A2' in M1);
101 assertTrue('A1' in M2);
102 assertEquals("object", typeof M1.A2);
103 assertEquals("object", typeof M2.A1);
104 assertTrue('A1' in M1.A2);
105 assertTrue('A2' in M2.A1);
106 assertEquals("object", typeof M1.A2.A1);
107 assertEquals("object", typeof M2.A1.A2);
108
109 assertSame(B, A.B);
110 assertSame(B, B.BB);
111 assertSame(B, A.C.D);
112 assertSame(A.C, A.C.C);
113 assertFalse(A.D === A.C.D);
114
115 assertSame(M1, M2.A1);
116 assertSame(M2, M1.A2);
117 assertSame(M1, M1.A2.A1);
118 assertSame(M2, M2.A1.A2);
119
120 // TODO(rossberg): inner declarations are not executed yet.
121 // assertEquals("1234567890", log);
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/mjsunit/harmony/module-parsing.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698