| 1 |
|
| 2 |
import common |
| 3 |
from common import setup_module, teardown_module |
| 4 |
from __main__ import py |
| 5 |
|
| 6 |
import os, sys |
| 7 |
input_name = '%s/../COPYING' % os.path.dirname(sys.argv[0]) |
| 8 |
with open(input_name) as f: |
| 9 |
input = f.read() |
| 10 |
|
| 11 |
def test_1(): |
| 12 |
|
| 13 |
yield validate, 'texte..texte' |
| 14 |
|
| 15 |
|
| 16 |
yield validate, 'latin1..ibmpc/' |
| 17 |
|
| 18 |
|
| 19 |
yield validate, 'latin1..ibmpc' |
| 20 |
|
| 21 |
|
| 22 |
yield validate, 'texte..latin1' |
| 23 |
|
| 24 |
|
| 25 |
yield validate, 'texte..bangbang' |
| 26 |
|
| 27 |
|
| 28 |
yield validate, 'texte..ibmpc' |
| 29 |
|
| 30 |
|
| 31 |
yield validate, 'texte..iconqnx' |
| 32 |
|
| 33 |
|
| 34 |
yield validate, 'ascii-bs..ebcdic' |
| 35 |
|
| 36 |
def validate(request): |
| 37 |
before, after = request.split('..') |
| 38 |
|
| 39 |
|
| 40 |
if os.name == 'nt': |
| 41 |
py.test.skip() |
| 42 |
command = ('$R --quiet --force < %s %s' |
| 43 |
'| $R --quiet --force %s..%s' |
| 44 |
% (input_name, request, after, before)) |
| 45 |
print(command) |
| 46 |
output = common.external_output(command) |
| 47 |
common.assert_or_diff(output, input) |
| 48 |
|
| 49 |
|
| 50 |
with open(common.run.work, 'w') as f: |
| 51 |
f.write(input) |
| 52 |
command1 = ('$R --quiet --force %s %s' |
| 53 |
% (request, common.run.work)) |
| 54 |
command2 = ('$R --quiet --force %s..%s %s' |
| 55 |
% (after, before, common.run.work)) |
| 56 |
print(command1) |
| 57 |
print(command2) |
| 58 |
common.external_output(command1) |
| 59 |
common.external_output(command2) |
| 60 |
with open(common.run.work) as f: |
| 61 |
output = f.read() |
| 62 |
common.assert_or_diff(output, input) |