| 723 | self.__expect_lines(self.__read_file(filename), line, expected) |
| 724 | |
| 725 | def expect_content(self, name, content, exact=False): |
| 726 | actual = self.__read_file(name, exact) |
| 727 | content = content.replace("$toolset", self.toolset + "*") |
| 728 | |
| 729 | matched = False |
| 730 | if exact: |
| 731 | matched = fnmatch.fnmatch(actual, content) |
| 732 | else: |
| 733 | def sorted_(x): |
| 734 | x.sort() |
| 735 | return x |
| 736 | actual_ = map(lambda x: sorted_(x.split()), actual.splitlines()) |
| 737 | content_ = map(lambda x: sorted_(x.split()), content.splitlines()) |
| 738 | if len(actual_) == len(content_): |
| 739 | matched = map( |
| 740 | lambda x, y: map(lambda n, p: fnmatch.fnmatch(n, p), x, y), |
| 741 | actual_, content_) |
| 742 | matched = reduce( |
| 743 | lambda x, y: x and reduce( |
| 744 | lambda a, b: a and b, |
| 745 | y), |
| 746 | matched) |
| 747 | |
| 748 | if not matched: |
| 749 | print "Expected:\n" |
| 750 | print content |
| 751 | print "Got:\n" |
| 752 | print actual |
| 753 | self.fail_test(1) |
| 754 | |
| 755 | def maybe_do_diff(self, actual, expected): |
| 756 | if os.environ.get("DO_DIFF"): |