]> granicus.if.org Git - recode/commitdiff
tests/t50_methods.py: remove obsolete tests
authorReuben Thomas <rrt@sc3d.org>
Sun, 1 Sep 2019 15:30:48 +0000 (16:30 +0100)
committerReuben Thomas <rrt@sc3d.org>
Sun, 1 Sep 2019 15:30:48 +0000 (16:30 +0100)
The --sequence option no longer does anything, so remove tests that differ
only in that flag; shorten the remaining code.

tests/t50_methods.py

index 66da2e6182cbfc70d0eb7982cf879235af78ec7d..696bb28b11e8dcb5fd396eed474e444ed73a0e6c 100644 (file)
@@ -8,77 +8,52 @@ input_name = '%s/../COPYING' % os.path.dirname(sys.argv[0])
 input = file(input_name, 'rb').read()
 
 def test_1():
-
     # No step at all.
-    yield validate, 'texte..texte', 'memory', 'filter'
-    yield validate, 'texte..texte', 'memory', 'squash'
-    yield validate, 'texte..texte', 'pipe', 'filter'
-    yield validate, 'texte..texte', 'pipe', 'squash'
+    yield validate, 'texte..texte'
 
     # One single step.
-    yield validate, 'latin1..ibmpc/', 'memory', 'filter'
-    yield validate, 'latin1..ibmpc/', 'memory', 'squash'
-    yield validate, 'latin1..ibmpc/', 'pipe', 'filter'
-    yield validate, 'latin1..ibmpc/', 'pipe', 'squash'
+    yield validate, 'latin1..ibmpc/'
 
     # One single step and a surface
-    yield validate, 'latin1..ibmpc', 'memory', 'filter'
-    yield validate, 'latin1..ibmpc', 'memory', 'squash'
-    yield validate, 'latin1..ibmpc', 'pipe', 'filter'
-    yield validate, 'latin1..ibmpc', 'pipe', 'squash'
+    yield validate, 'latin1..ibmpc'
 
     # One single step.
-    yield validate, 'texte..latin1', 'memory', 'filter'
-    yield validate, 'texte..latin1', 'memory', 'squash'
-    yield validate, 'texte..latin1', 'pipe', 'filter'
-    yield validate, 'texte..latin1', 'pipe', 'squash'
+    yield validate, 'texte..latin1'
 
     # Two single steps.
-    yield validate, 'texte..bangbang', 'memory', 'filter'
-    yield validate, 'texte..bangbang', 'memory', 'squash'
-    yield validate, 'texte..bangbang', 'pipe', 'filter'
-    yield validate, 'texte..bangbang', 'pipe', 'squash'
+    yield validate, 'texte..bangbang'
 
     # Two single steps and a surface.
-    yield validate, 'texte..ibmpc', 'memory', 'filter'
-    yield validate, 'texte..ibmpc', 'memory', 'squash'
-    yield validate, 'texte..ibmpc', 'pipe', 'filter'
-    yield validate, 'texte..ibmpc', 'pipe', 'squash'
+    yield validate, 'texte..ibmpc'
 
     # Three single steps.
-    yield validate, 'texte..iconqnx', 'memory', 'filter'
-    yield validate, 'texte..iconqnx', 'memory', 'squash'
-    yield validate, 'texte..iconqnx', 'pipe', 'filter'
-    yield validate, 'texte..iconqnx', 'pipe', 'squash'
+    yield validate, 'texte..iconqnx'
 
     # Four single steps, optimized into three (with iconv) or two (without).
-    yield validate, 'ascii-bs..ebcdic', 'memory', 'filter'
-    yield validate, 'ascii-bs..ebcdic', 'memory', 'squash'
-    yield validate, 'ascii-bs..ebcdic', 'pipe', 'filter'
-    yield validate, 'ascii-bs..ebcdic', 'pipe', 'squash'
+    yield validate, 'ascii-bs..ebcdic'
 
-def validate(request, sequence, mode):
+def validate(request):
     before, after = request.split('..')
-    if mode == 'filter':
-        if os.name == 'nt':
-            py.test.skip()
-        command = ('$R --quiet --force --sequence=%s < %s %s'
-                   '| $R --quiet --force --sequence=%s %s..%s'
-                   % (sequence, input_name, request, sequence, after, before))
-        print command
-        output = common.external_output(command)
-    elif mode == 'squash':
-        file(common.run.work, 'wb').write(input)
-        command1 = ('$R --quiet --force --sequence=%s %s %s'
-                    % (sequence, request, common.run.work))
-        command2 = ('$R --quiet --force --sequence=%s %s..%s %s'
-                    % (sequence, after, before, common.run.work))
 
-        print command1
-        print command2
-        common.external_output(command1)
-        common.external_output(command2)
-        output = file(common.run.work, 'rb').read()
-    else:
-        assert False, mode
+    # With a pipe
+    if os.name == 'nt':
+        py.test.skip()
+    command = ('$R --quiet --force < %s %s'
+               '| $R --quiet --force %s..%s'
+               % (input_name, request, after, before))
+    print command
+    output = common.external_output(command)
+    common.assert_or_diff(output, input)
+
+    # With an intermediate file
+    file(common.run.work, 'wb').write(input)
+    command1 = ('$R --quiet --force %s %s'
+                % (request, common.run.work))
+    command2 = ('$R --quiet --force %s..%s %s'
+                % (after, before, common.run.work))
+    print command1
+    print command2
+    common.external_output(command1)
+    common.external_output(command2)
+    output = file(common.run.work, 'rb').read()
     common.assert_or_diff(output, input)