Commits

allisonrandal  committed e1cd3ff

Renaming test files to be more pythonic.

  • Participants
  • Parent commits 8edbb7d

Comments (0)

Files changed (26)

File build/Makefile.in

 
 ##  testing targets
 test    : build
-	$(PERL) t/harness t/00-parrot
+	$(PERL) t/harness test/00-parrot
 
 # basic run for missing libs
 test-installable: installable

File test/00-parrot/01-literals.py

+#!./parrot pynie.pbc
+
+# check literals
+
+print '1..7'
+
+0
+1
+12
+
+#123l
+#1234L
+
+
+
+print 'ok 1'
+
+
+01
+02
+03
+04
+05
+06
+07
+
+print 'ok 2'
+
+0x1
+0x2
+0x3
+0x4
+0x5
+0x6
+0x7
+0x8
+0x9
+0xa
+0xA
+0xb
+0xB
+0xc
+0xC
+0xd
+0xD
+0xe
+0xE
+0xf
+0xF
+0xdeadbeef
+
+print 'ok 3'
+
+#3.14
+#10.
+#.001
+#1e100
+#
+#3.14e-10
+#0e0
+#0E0
+#
+
+print 'ok',
+
+print 4
+
+#3.14j
+#10.j
+#10j
+#.001j
+#1e100j
+#3.14e-10j
+#1J
+
+print 'ok 5'
+
+# prefix:+
+print 'ok', +6
+x = +7
+print 'ok', x

File test/00-parrot/01-literals.t

-#!./parrot pynie.pbc
-
-# check literals
-
-print '1..7'
-
-0
-1
-12
-
-#123l
-#1234L
-
-
-
-print 'ok 1'
-
-
-01
-02
-03
-04
-05
-06
-07
-
-print 'ok 2'
-
-0x1
-0x2
-0x3
-0x4
-0x5
-0x6
-0x7
-0x8
-0x9
-0xa
-0xA
-0xb
-0xB
-0xc
-0xC
-0xd
-0xD
-0xe
-0xE
-0xf
-0xF
-0xdeadbeef
-
-print 'ok 3'
-
-#3.14
-#10.
-#.001
-#1e100
-#
-#3.14e-10
-#0e0
-#0E0
-#
-
-print 'ok',
-
-print 4
-
-#3.14j
-#10.j
-#10j
-#.001j
-#1e100j
-#3.14e-10j
-#1J
-
-print 'ok 5'
-
-# prefix:+
-print 'ok', +6
-x = +7
-print 'ok', x

File test/00-parrot/02-op-math.py

+#!./parrot pynie.pbc
+
+print '1..14'
+
+# basic math operators
+
+print 'ok', 0 + 1
+print 'ok', 1 + 1
+print 'ok', 4 - 1
+print 'ok', 2 * 2
+
+# //, << and >>  operators
+print 'ok', 10 // 2
+print 'ok', 3<<1
+print 'ok', 14>>1
+print 'ok', 0 // 1 + 8
+
+# ** operator
+print 'ok', 3**2
+print 'ok', 0**0+9
+print 'ok', 0**1+11
+print 'ok', 1**0+11
+
+# unary + and -
+print 'ok', +13
+print 'ok', -10 + 24

File test/00-parrot/02-op-math.t

-#!./parrot pynie.pbc
-
-print '1..14'
-
-# basic math operators
-
-print 'ok', 0 + 1
-print 'ok', 1 + 1
-print 'ok', 4 - 1
-print 'ok', 2 * 2
-
-# //, << and >>  operators
-print 'ok', 10 // 2
-print 'ok', 3<<1
-print 'ok', 14>>1
-print 'ok', 0 // 1 + 8
-
-# ** operator
-print 'ok', 3**2
-print 'ok', 0**0+9
-print 'ok', 0**1+11
-print 'ok', 1**0+11
-
-# unary + and -
-print 'ok', +13
-print 'ok', -10 + 24

File test/00-parrot/03-op-logic.py

+#!./parrot pynie.pbc
+
+print '1..8'
+
+# &
+
+print 'ok', (0 & 0) + 1
+print 'ok', (1 & 0) + 2
+print 'ok', (0 & 1) + 3
+print 'ok', (1 & 1) + 3
+
+# |
+
+print 'ok', (0 | 0) + 5
+print 'ok', (1 | 0) + 5
+print 'ok', (0 | 1) + 6
+print 'ok', (1 | 1) + 7

File test/00-parrot/03-op-logic.t

-#!./parrot pynie.pbc
-
-print '1..8'
-
-# &
-
-print 'ok', (0 & 0) + 1
-print 'ok', (1 & 0) + 2
-print 'ok', (0 & 1) + 3
-print 'ok', (1 & 1) + 3
-
-# |
-
-print 'ok', (0 | 0) + 5
-print 'ok', (1 | 0) + 5
-print 'ok', (0 | 1) + 6
-print 'ok', (1 | 1) + 7

File test/00-parrot/05-vars.py

+#!./parrot pynie.pbc
+
+print '1..4'
+
+i=1
+print 'ok', i
+i=i+1
+print 'ok', i
+s='3'
+print 'ok', s
+s='ok 4'
+print s

File test/00-parrot/05-vars.t

-#!./parrot pynie.pbc
-
-print '1..4'
-
-i=1
-print 'ok', i
-i=i+1
-print 'ok', i
-s='3'
-print 'ok', s
-s='ok 4'
-print s

File test/00-parrot/06-stmts.py

+#!./parrot pynie.pbc
+
+print '1..13'
+
+# if
+
+if 1: print 'ok 1'
+if 0: print 'nok 2'
+else: print 'ok 2'
+if 0: print 'nok 3'
+elif 1: print 'ok 3'
+if 0: print 'nok 4'
+elif 0: print 'nok 4'
+else: print 'ok 4'
+
+# while
+
+i=5
+while i < 7:
+    print 'ok',i
+    i=i+1
+while 0:
+    print 'nok 7'
+else:
+    print 'ok 7'
+
+# for
+
+lst = [ 1,2,3,4 ]
+n = 0
+ok = 1
+for i in lst:
+    n += 1
+    if i != n: ok = 0
+if ok: print 'ok 8'
+else: print 'nok 8'
+
+n = 0
+ok = 1
+for i in [ 1,2,3,4 ]:
+    n += 1
+    if i != n: ok = 0
+if ok: print 'ok 9'
+else: print 'nok 9'
+
+n = 0
+ok = 1
+for i in 1,2,3,4:
+    n += 1
+    if i != n: ok = 0
+if ok: print 'ok 10'
+else: print 'nok 10'
+
+# nested fors
+lst = [ ]
+for i in range(3):
+    # XXX ResizablePMCArray has a 'push' method, use list.append
+    for j in range(3):
+        lst.push((i + 1) * (j + 1))
+ok = 1
+lst2 = [ 1, 2, 3,  2, 4, 6,  3, 6, 9 ]
+for i in range(9):
+    if lst[i] != lst2[i]: ok = 0
+if ok: print 'ok 11'
+else: print 'nok 11'
+
+# multiple iterators
+#ok = 0
+#for i, j in ( (0, 0), (1, 2), (2, 4) ):
+#    if j == i * 2: ok += 1
+#if ok == 3: print 'ok 12'
+#else: print 'nok 12'
+print 'not ok 12  # TODO implement multiple iterators'
+
+# nested scopes
+i = 4
+if 0:
+    if 0: pass
+    i = 2
+if i == 2: print 'nok 13'
+else: print 'ok 13'

File test/00-parrot/06-stmts.t

-#!./parrot pynie.pbc
-
-print '1..13'
-
-# if
-
-if 1: print 'ok 1'
-if 0: print 'nok 2'
-else: print 'ok 2'
-if 0: print 'nok 3'
-elif 1: print 'ok 3'
-if 0: print 'nok 4'
-elif 0: print 'nok 4'
-else: print 'ok 4'
-
-# while
-
-i=5
-while i < 7:
-    print 'ok',i
-    i=i+1
-while 0:
-    print 'nok 7'
-else:
-    print 'ok 7'
-
-# for
-
-lst = [ 1,2,3,4 ]
-n = 0
-ok = 1
-for i in lst:
-    n += 1
-    if i != n: ok = 0
-if ok: print 'ok 8'
-else: print 'nok 8'
-
-n = 0
-ok = 1
-for i in [ 1,2,3,4 ]:
-    n += 1
-    if i != n: ok = 0
-if ok: print 'ok 9'
-else: print 'nok 9'
-
-n = 0
-ok = 1
-for i in 1,2,3,4:
-    n += 1
-    if i != n: ok = 0
-if ok: print 'ok 10'
-else: print 'nok 10'
-
-# nested fors
-lst = [ ]
-for i in range(3):
-    # XXX ResizablePMCArray has a 'push' method, use list.append
-    for j in range(3):
-        lst.push((i + 1) * (j + 1))
-ok = 1
-lst2 = [ 1, 2, 3,  2, 4, 6,  3, 6, 9 ]
-for i in range(9):
-    if lst[i] != lst2[i]: ok = 0
-if ok: print 'ok 11'
-else: print 'nok 11'
-
-# multiple iterators
-#ok = 0
-#for i, j in ( (0, 0), (1, 2), (2, 4) ):
-#    if j == i * 2: ok += 1
-#if ok == 3: print 'ok 12'
-#else: print 'nok 12'
-print 'not ok 12  # TODO implement multiple iterators'
-
-# nested scopes
-i = 4
-if 0:
-    if 0: pass
-    i = 2
-if i == 2: print 'nok 13'
-else: print 'ok 13'

File test/00-parrot/07-op-cmp.py

+#!./parrot pynie.pbc
+
+print '1..8'
+
+if 0 < 1: print 'ok 1'
+if 1 > 0: print 'ok 2'
+if 0 <= 1: print 'ok 3'
+if 0 <= 0: print 'ok 4'
+if 1 >= 0: print 'ok 5'
+if 0 >= 0: print 'ok 6'
+if 0 < 1 < 2: print 'ok 7'
+if 2 > 1 > 0: print 'ok 8'

File test/00-parrot/07-op-cmp.t

-#!./parrot pynie.pbc
-
-print '1..8'
-
-if 0 < 1: print 'ok 1'
-if 1 > 0: print 'ok 2'
-if 0 <= 1: print 'ok 3'
-if 0 <= 0: print 'ok 4'
-if 1 >= 0: print 'ok 5'
-if 0 >= 0: print 'ok 6'
-if 0 < 1 < 2: print 'ok 7'
-if 2 > 1 > 0: print 'ok 8'

File test/00-parrot/08-func.py

+#!./parrot pynie.pbc
+
+print '1..2'
+
+def x():
+ print "The wow starts now!\n"
+
+x()
+
+print 'ok 1'
+
+def y(a,b,c):
+ pass
+
+y(1,2,3)
+
+print 'ok 2'

File test/00-parrot/08-func.t

-#!./parrot pynie.pbc
-
-print '1..2'
-
-def x():
- print "The wow starts now!\n"
-
-x()
-
-print 'ok 1'
-
-def y(a,b,c):
- pass
-
-y(1,2,3)
-
-print 'ok 2'

File test/00-parrot/09-list.py

+#!./parrot
+
+print '1..5'
+
+a = ["parrot"]
+if a: print 'ok', a
+else: print 'nok 1'
+b = ["ok 2", ["ok 3"]]
+print b[0]
+print b[1][0]
+
+c = ("ok 4")
+d = ("ok 5",)
+print c
+print d[0]

File test/00-parrot/09-list.t

-#!./parrot
-
-print '1..5'
-
-a = ["parrot"]
-if a: print 'ok', a
-else: print 'nok 1'
-b = ["ok 2", ["ok 3"]]
-print b[0]
-print b[1][0]
-
-c = ("ok 4")
-d = ("ok 5",)
-print c
-print d[0]

File test/00-parrot/10-augop.py

+#!./parrot pynie.pbc
+
+# check augmented assignment ops
+print '1..11'
+
+i = 0
+i += 10
+if i == 10: print 'ok 1'
+else: print 'not ok 1'
+
+i = 10
+i -= 5
+if i == 5: print 'ok 2'
+else: print 'not ok 2'
+
+i = -5
+i *= 2
+if i == -10: print 'ok 3'
+else: print 'not ok 3'
+
+i = 10
+i /= 2
+if i == 5: print 'ok 4'
+else: print 'not ok 4'
+
+i = 10
+i %= 4
+if i == 2: print 'ok 5'
+else: print 'not ok 5'
+
+#i = 3
+#i **= 3
+#if i == 27: print 'ok 6'
+#else: print 'not ok 6'
+print 'not ok 6   # TODO implement **='
+
+i = 128
+i >>= 2
+if i == 32: print 'ok 7'
+else: print 'not ok 7'
+
+i = 1
+i <<= 10
+if i == 1024: print 'ok 8'
+else: print 'not ok 8'
+
+i = 0x55
+i &= 0x1f
+if i == 0x15: print 'ok 9'
+else: print 'not ok 9'
+
+i = 0x55
+i ^= 0x1f
+if i == 0x4a: print 'ok 10'
+else: print 'not ok 10'
+
+i = 0x55
+i |= 0x1f
+if i == 0x5f: print 'ok 11'
+else: print 'not ok 11'

File test/00-parrot/10-augop.t

-#!./parrot pynie.pbc
-
-# check augmented assignment ops
-print '1..11'
-
-i = 0
-i += 10
-if i == 10: print 'ok 1'
-else: print 'not ok 1'
-
-i = 10
-i -= 5
-if i == 5: print 'ok 2'
-else: print 'not ok 2'
-
-i = -5
-i *= 2
-if i == -10: print 'ok 3'
-else: print 'not ok 3'
-
-i = 10
-i /= 2
-if i == 5: print 'ok 4'
-else: print 'not ok 4'
-
-i = 10
-i %= 4
-if i == 2: print 'ok 5'
-else: print 'not ok 5'
-
-#i = 3
-#i **= 3
-#if i == 27: print 'ok 6'
-#else: print 'not ok 6'
-print 'not ok 6   # TODO implement **='
-
-i = 128
-i >>= 2
-if i == 32: print 'ok 7'
-else: print 'not ok 7'
-
-i = 1
-i <<= 10
-if i == 1024: print 'ok 8'
-else: print 'not ok 8'
-
-i = 0x55
-i &= 0x1f
-if i == 0x15: print 'ok 9'
-else: print 'not ok 9'
-
-i = 0x55
-i ^= 0x1f
-if i == 0x4a: print 'ok 10'
-else: print 'not ok 10'
-
-i = 0x55
-i |= 0x1f
-if i == 0x5f: print 'ok 11'
-else: print 'not ok 11'

File test/00-parrot/11-boolop.py

+#!./parrot pynie.pbc
+
+print '1..9'
+
+if 1 and 2 and 3:
+    print 'ok 1'
+else:
+    print 'not ok 1'
+
+if 0 and 1 and 2:
+    print 'not ok 2'
+else:
+    print 'ok 2'
+
+if 0 or 1 or 2:
+    print 'ok 3'
+else:
+    print 'not ok 3'
+
+if 0 or 0 or 0:
+    print 'not ok 4'
+else:
+    print 'ok 4'
+
+if not 0:
+    print 'ok 5'
+else:
+    print 'not ok 5'
+
+if not 1:
+    print 'not ok 6'
+else:
+    print 'ok 6'
+
+if 1 or 0 and 0:   # and should be tighter than or
+    print 'ok 7'
+else:
+    print 'not ok 7'
+
+if (1 or 0) and 0:   # test parentheses
+    print 'not ok 8'
+else:
+    print 'ok 8'
+
+#if not not 1:
+#   print 'ok 9'
+#else:
+#   print 'not ok 9'
+print 'not ok 9   # TODO fix double nots'

File test/00-parrot/11-boolop.t

-#!./parrot pynie.pbc
-
-print '1..9'
-
-if 1 and 2 and 3:
-    print 'ok 1'
-else:
-    print 'not ok 1'
-
-if 0 and 1 and 2:
-    print 'not ok 2'
-else:
-    print 'ok 2'
-
-if 0 or 1 or 2:
-    print 'ok 3'
-else:
-    print 'not ok 3'
-
-if 0 or 0 or 0:
-    print 'not ok 4'
-else:
-    print 'ok 4'
-
-if not 0:
-    print 'ok 5'
-else:
-    print 'not ok 5'
-
-if not 1:
-    print 'not ok 6'
-else:
-    print 'ok 6'
-
-if 1 or 0 and 0:   # and should be tighter than or
-    print 'ok 7'
-else:
-    print 'not ok 7'
-
-if (1 or 0) and 0:   # test parentheses
-    print 'not ok 8'
-else:
-    print 'ok 8'
-
-#if not not 1:
-#   print 'ok 9'
-#else:
-#   print 'not ok 9'
-print 'not ok 9   # TODO fix double nots'

File test/00-parrot/12-try.py

+#!./parrot pynie.pbc
+
+print '1..5'
+
+try:
+    x = 1
+    raise Exception
+except:
+    x = 2
+if x == 2: print 'ok 1'
+else: print 'not ok 1'
+
+try:
+    x = 1
+except:
+    x = 2
+if x == 1: print 'ok 2'
+else: print 'not ok 2'
+
+# make sure asserts are on
+# XXX in real Python, you can't set __debug__
+__debug__ = 1
+
+try:
+    x = 1
+    assert 0
+except:
+    x = 2
+if x == 2: print 'ok 3'
+else: print 'not ok 3'
+
+try:
+    x = 1
+    assert 1
+except:
+    x = 2
+if x == 1: print 'ok 4'
+else: print 'not ok 4'
+
+__debug__ = 0
+try:
+    x = 1
+    assert 0
+except:
+    x = 2
+if x == 1: print 'ok 5'
+else: print 'not ok 5'

File test/00-parrot/12-try.t

-#!./parrot pynie.pbc
-
-print '1..5'
-
-try:
-    x = 1
-    raise Exception
-except:
-    x = 2
-if x == 2: print 'ok 1'
-else: print 'not ok 1'
-
-try:
-    x = 1
-except:
-    x = 2
-if x == 1: print 'ok 2'
-else: print 'not ok 2'
-
-# make sure asserts are on
-# XXX in real Python, you can't set __debug__
-__debug__ = 1
-
-try:
-    x = 1
-    assert 0
-except:
-    x = 2
-if x == 2: print 'ok 3'
-else: print 'not ok 3'
-
-try:
-    x = 1
-    assert 1
-except:
-    x = 2
-if x == 1: print 'ok 4'
-else: print 'not ok 4'
-
-__debug__ = 0
-try:
-    x = 1
-    assert 0
-except:
-    x = 2
-if x == 1: print 'ok 5'
-else: print 'not ok 5'

File test/00-parrot/13-builtins.py

+#!./parrot pynie.pbc
+
+print '1..5'
+
+#len
+n = len([1,2,3,4])
+if n == 4: print 'ok 1'
+else: print 'not ok 1'
+
+#list
+lst1 = [ 1,2,3,4 ]
+lst2 = list(lst1)
+lst1.pop()
+lst1.pop()
+lst1.pop()
+lst1.pop()
+if lst2[2] == 3: print 'ok 2'
+else: print 'not ok 2'
+
+#range
+lst = range(4)
+ok = 0
+n = -1
+for i in lst:
+    n += 1
+    if n == i: ok += 1
+if ok == 4: print 'ok 3'
+else: print 'not ok 3'
+
+#str
+if str(5) == '5': print 'ok 4'
+else: print 'not ok 4'
+
+if len(str(861)) == 3: print 'ok 5'
+else: print 'not ok 5'

File test/00-parrot/13-builtins.t

-#!./parrot pynie.pbc
-
-print '1..5'
-
-#len
-n = len([1,2,3,4])
-if n == 4: print 'ok 1'
-else: print 'not ok 1'
-
-#list
-lst1 = [ 1,2,3,4 ]
-lst2 = list(lst1)
-lst1.pop()
-lst1.pop()
-lst1.pop()
-lst1.pop()
-if lst2[2] == 3: print 'ok 2'
-else: print 'not ok 2'
-
-#range
-lst = range(4)
-ok = 0
-n = -1
-for i in lst:
-    n += 1
-    if n == i: ok += 1
-if ok == 4: print 'ok 3'
-else: print 'not ok 3'
-
-#str
-if str(5) == '5': print 'ok 4'
-else: print 'not ok 4'
-
-if len(str(861)) == 3: print 'ok 5'
-else: print 'not ok 5'

File test/harness

 
 runtests(@tfiles);
 
-# adapted to return only files ending in '.t'
+# adapted to return only files ending in '.py'
 sub all_in {
     my $start = shift;
 
             if ( -d $currfile ) {
                 push( @hits, all_in( $currfile ) );
             } else {
-                push( @hits, $currfile ) if $currfile =~ /\.t$/;
+                push( @hits, $currfile ) if $currfile =~ /\.py$/;
             }
         }
     } else {