update NOTICE and LICENSE
[nit.git] / tests / base_closure_forms.nit
index fa2a8bd..262d433 100644 (file)
@@ -56,12 +56,12 @@ class Array[E]
 end
 
 class Map[K, V]
-       fun get(k: K): V
+       fun [](k: K): V
                !def: V do abort
        do
                if _k == k then return _v
                var n = _next
-               if n != null then return n.get(k) !def do continue def
+               if n != null then return n[k] !def do continue def
                var v = def
                _next = new Map[K, V](k, v)
                return v
@@ -129,7 +129,7 @@ end
 
 fun file_open(i: Int)
        !work(f: File)
-       break !error(i: Int) do abort
+       break !error(j: Int) do abort
 do
        var f = new File(i)
        if not f.is_open then error(404)
@@ -143,9 +143,9 @@ fun test_sort
 do
        var a = new Array[Char]('2', '1')
        a.output
-       a.sort !cmp(x, y) do continue x <=> y
+       a.sort !cmp(x, y) = x <=> y
        a.output
-       a.sort !cmp(x, y) do continue y <=> x
+       a.sort !cmp(x, y) = y <=> x
        a.output
        a.iterate !each i do i.output
        '\n'.output
@@ -160,7 +160,7 @@ do
        if not m.has_key('I') then (-1).output
        'I'.output
        '='.output
-       var i = m.get('I')
+       var i = m['I']
        i.output
        '\n'.output
 
@@ -169,7 +169,7 @@ do
        if m.has_key('V') then (-2).output
        'V'.output
        '='.output
-       i = m.get('V') !def do continue '5'
+       i = m['V'] !def = '5'
        i.output
        '\n'.output
 
@@ -178,7 +178,7 @@ do
        if not m.has_key('V') then (-3).output
        'V'.output
        '='.output
-       i = m.get('V') !def do continue '6'
+       i = m['V'] !def = '6'
        i.output
        '\n'.output
 
@@ -187,7 +187,7 @@ do
        if m.has_key('X') then (-4).output
        'X'.output
        '='.output
-       i = m.get('X') !def do break '0'
+       i = m['X'] !def do break '0'
        i.output
        '\n'.output
 
@@ -215,7 +215,6 @@ do
        !error(e) do
                'E'.output
                e.output
-               break
        end
        if f_escape != null then
                'O'.output