]> granicus.if.org Git - recode/commitdiff
t40_java.py: fix qp to Java test
authorReuben Thomas <rrt@sc3d.org>
Wed, 17 Jan 2018 14:34:41 +0000 (14:34 +0000)
committerReuben Thomas <rrt@sc3d.org>
Tue, 23 Jan 2018 07:02:41 +0000 (07:02 +0000)
When converting individual characters in Java source, we don’t add BOMs, so
don’t require them in the output.

test_2 ends up only doing one direction, but that’s OK because test_1 does
the other.

tests/t40_java.py

index 50824eac01f39489e686cb1736f006e60461b173..056a9b87bb30b7f47ea0c457d47bacfab072804c 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 import common
-from common import setup_module, teardown_module
+from common import setup_module, teardown_module, Recode, outer, assert_or_diff
 
 input = '''\
 Dear =DEorvard=F0ur,
@@ -26,6 +26,12 @@ class Test:
         common.validate(input, output)
 
     def test_2(self):
-        # Block of lines to Java and back.
-        common.request('l1/qp..java')
-        common.validate_back(input)
+        # Block of lines from Java, without requiring BOM for each Unicode character.
+        request = Recode.Request(outer)
+        request.scan('java..l1/qp')
+        task = Recode.Task(request)
+        task.set_byte_order_mark(False)
+        task.set_input(output)
+        task.perform()
+        task_output = task.get_output()
+        assert_or_diff(task_output, input)