Changeset 173 for trunk/tests

Show
Ignore:
Timestamp:
05/27/07 16:59:34 (2 years ago)
Author:
JarrettBillingsley
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tests/base.md

    r170 r173  
    6969currentThread(); 
    7070curry(function(x, y){}, 3)(4); 
    71 try require("blahblah"); catch(e){} 
    72 require("tests.dummy"); 
     71try import("blahblah"); catch(e){} 
     72import("tests.dummy"); 
    7373loadString(""); 
    7474loadString("", "h"); 
     
    108108try s[-392096 .. 0] = "h"; catch(e){} 
    109109 
    110 readf("%d"); 
     110
     111    function loadMod(name, ns) 
     112    { 
     113        assert(name == "mod"); 
     114     
     115        ns.x = "I'm x"; 
     116     
     117        ns.foo = function foo() 
     118        { 
     119            writefln("foo"); 
     120        }; 
     121     
     122        ns.bar = function bar(x) 
     123        { 
     124            return x[0]; 
     125        }; 
     126     
     127        ns.baz = function baz() 
     128        { 
     129            writefln(x); 
     130        }; 
     131     
     132        foreach(k, v; ns) 
     133            if(isFunction(v)) 
     134                v.environment(ns); 
     135    } 
     136     
     137    setModuleLoader("mod", loadMod); 
     138     
     139    import mod : foo, bar; 
     140    foo(); 
     141    writefln(bar([5])); 
     142    mod.baz(); 
     143     
     144    writefln(); 
     145     
     146    readf("%d"); 
     147
  • trunk/tests/compiler/compiler.md

    r172 r173  
    233233try loadString("if([]){}"); catch(e){} 
    234234loadString("yield(1); yield(f()); class A : B { this() { super(); } function f() { super.f(2); x = [super.f()]; }}"); 
    235 try require("tests.compiler.dupimportlocals"); catch(e){} 
    236 require("tests.compiler.noimportlocals"); 
     235try import("tests.compiler.dupimportlocals"); catch(e){} 
     236import("tests.compiler.noimportlocals"); 
     237loadString("namespace a : b { function foo(){} bar = 5; baz; } local namespace b {} namespace c{} global namespace d {} "); 
     238loadString("x = namespace x{};"); 
     239try loadString("namespace a{"); catch(e){} 
     240try loadString("namespace a { x; x; }"); catch(e){} 
     241try loadString("namespace a { #### }"); catch(e){} 
    237242try loadString(`x = "hello\`); catch(e){}