示例#1
0
def validate(request, sequence, mode):
    before, after = request.split('..')
    if mode == 'filter':
        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
    common.assert_or_diff(output, input)
示例#2
0
 def test_1(self):
     output = common.external_output('$R -lh latin-1')
     common.assert_or_diff(output, self.expected)
示例#3
0
def test_1():
    output = common.external_output('$R --find-subsets')
    # FIXME: The output is not sorted appropriately.
    output2 = ''.join(sorted(output.splitlines(True)))
    expected2 = ''.join(sorted(expected.splitlines(True)))
    common.assert_or_diff(output2, expected2)
示例#4
0
def test_1():
    output = common.external_output('$R -l')
    common.assert_or_diff(output, expected)
示例#5
0
def test_1():
    output = common.external_output('$R -T')
    # FIXME: The output is not sorted appropriately.
    output2 = ''.join(sorted(output.splitlines(True)))
    expected2 = ''.join(sorted(expected.splitlines(True)))
    common.assert_or_diff(output2, expected2)
示例#6
0
def test_1():
    common.request('u8..l1')
    output = common.recode_iconv_output(input)
    expected = ''.join(input.splitlines(True)[-6:])
    output = ''.join(output.splitlines(True)[-6:])
    common.assert_or_diff(output, expected)