def testInitWithGoodData(self): good_data = """ # This is a test expectation file. # # tags: [ Release Debug ] # tags: [ Linux # Mac Mac10.1 Mac10.2 # Win ] # results: [ Skip ] crbug.com/12345 [ Mac ] b1/s1 [ Skip ] crbug.com/23456 [ Mac Debug ] b1/s2 [ Skip ] """ parser = expectations_parser.TaggedTestListParser(good_data) tag_sets = [{'Debug', 'Release'}, {'Linux', 'Mac', 'Mac10.1', 'Mac10.2', 'Win'}] self.assertEqual(tag_sets, parser.tag_sets) expected_outcome = [ expectations_parser.Expectation('crbug.com/12345', 'b1/s1', ['mac'], ['SKIP'], 10), expectations_parser.Expectation('crbug.com/23456', 'b1/s2', ['mac', 'debug'], ['SKIP'], 11) ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineMultipleTags(self): raw_data = ('# tags: [ All None batman ]\n' 'crbug.com/123 [ all ] b1/s1 [ Skip ]\n' 'crbug.com/124 [ None ] b1/s2 [ Pass ]\n' 'crbug.com/125 [ Batman ] b1/s3 [ Failure ]') parser = expectations_parser.TaggedTestListParser(raw_data) expected_outcome = [ expectations_parser.Expectation( 'crbug.com/123', 'b1/s1', ['all'], ['SKIP'], 2), expectations_parser.Expectation( 'crbug.com/124', 'b1/s2', ['none'], ['PASS'], 3), expectations_parser.Expectation( 'crbug.com/125', 'b1/s3', ['batman'], ['FAIL'], 4) ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineNoBugNoTags(self): raw_data = '# tags: [ All ]\n# results: [ Skip ]\nb1/s1 [ Skip ]' parser = expectations_parser.TaggedTestListParser(raw_data) expected_outcome = [ expectations_parser.Expectation(None, 'b1/s1', [], ['SKIP'], 3), ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineNoBug(self): raw_data = '# tags: [ All ]\n[ All ] b1/s1 [ Skip ]' parser = expectations_parser.TestExpectationParser(raw_data) expected_outcome = [ expectations_parser.Expectation(None, 'b1/s1', ['All'], ['SKIP']), ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineNoBugNoConditions(self): raw_data = '# tags: All\nb1/s1 [ Skip ]' parser = expectations_parser.TestExpectationParser(raw_data) expected_outcome = [ expectations_parser.Expectation(None, 'b1/s1', [], ['Skip']), ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineAngleProjectNoTags(self): raw_data = '# tags: [ ]\n# results: [ Skip ]\ncrbug.com/angleproject/23456 b1/s2 [ skip ]' parser = expectations_parser.TaggedTestListParser(raw_data) expected_outcome = [ expectations_parser.Expectation('crbug.com/angleproject/23456', 'b1/s2', [], ['SKIP'], 3) ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineEverythingThere(self): raw_data = '# tags: [ Mac ]\n# results: [ Skip ]\ncrbug.com/23456 [ Mac ] b1/s2 [ Skip ]' parser = expectations_parser.TaggedTestListParser(raw_data) expected_outcome = [ expectations_parser.Expectation('crbug.com/23456', 'b1/s2', ['mac'], ['SKIP'], 3) ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineNoTags(self): raw_data = '# tags: [ All ]\ncrbug.com/12345 b1/s1 [ Skip ]' parser = expectations_parser.TestExpectationParser(raw_data) expected_outcome = [ expectations_parser.Expectation('crbug.com/12345', 'b1/s1', [], ['SKIP']), ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineEverythingThere(self): raw_data = '# tags: Mac\ncrbug.com/23456 [ Mac ] b1/s2 [ Skip ]' parser = expectations_parser.TestExpectationParser(raw_data) expected_outcome = [ expectations_parser.Expectation('crbug.com/23456', 'b1/s2', ['Mac'], ['Skip']) ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineEndingComment(self): raw_data = ('# tags: [ Mac ]\n' 'crbug.com/23456 [ Mac ] b1/s2 [ Skip ] # abc 123') parser = expectations_parser.TestExpectationParser(raw_data) expected_outcome = [ expectations_parser.Expectation('crbug.com/23456', 'b1/s2', ['Mac'], ['SKIP']) ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineMultipleTags(self): raw_data = ('# tags: [ All None Batman ]\n' 'crbug.com/123 [ All None Batman ] b1/s1 [ Skip ]') parser = expectations_parser.TestExpectationParser(raw_data) expected_outcome = [ expectations_parser.Expectation('crbug.com/123', 'b1/s1', ['All', 'None', 'Batman'], ['SKIP']), ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationLineUrlInTestName(self): raw_data = ( '# tags: [ Mac ]\n# results: [ Skip ]\ncrbug.com/123 [ Mac ] b.1/http://google.com [ Skip ]' ) expected_outcomes = [ expectations_parser.Expectation( 'crbug.com/123', 'b.1/http://google.com', ['mac'], ['SKIP'], 3) ] parser = expectations_parser.TaggedTestListParser(raw_data) for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcomes[i])
def testParseExpectationLineUrlInTestName(self): raw_data = ( '# tags: Mac\ncrbug.com/123 [ Mac ] b.1/http://google.com [ Skip ]' ) expected_outcomes = [ expectations_parser.Expectation('crbug.com/123', 'b.1/http://google.com', ['Mac'], ['Skip']) ] parser = expectations_parser.TestExpectationParser(raw_data) for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcomes[i])
def testInitWithGoodData(self): good_data = """ # This is a test expectation file. # # tags: tag1 tag2 tag3 # tags: tag4 Mac Win Debug crbug.com/12345 [ Mac ] b1/s1 [ Skip ] crbug.com/23456 [ Mac Debug ] b1/s2 [ Skip ] """ parser = expectations_parser.TestExpectationParser(good_data) tags = ['tag1', 'tag2', 'tag3', 'tag4', 'Mac', 'Win', 'Debug'] self.assertEqual(parser.tags, tags) expected_outcome = [ expectations_parser.Expectation('crbug.com/12345', 'b1/s1', ['Mac'], ['Skip']), expectations_parser.Expectation('crbug.com/23456', 'b1/s2', ['Mac', 'Debug'], ['Skip']) ] for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcome[i])
def testParseExpectationPercentEscapeInTestName(self): raw_data = ( '# tags: [ Mac ]\n# results: [ Skip ]\ncrbug.com/123 [ Mac ] http://google.com/Foo%2520Bar [ Skip ]' ) expected_outcomes = [ expectations_parser.Expectation('crbug.com/123', 'http://google.com/Foo%20Bar', ['mac'], ['SKIP'], 3) ] parser = expectations_parser.TaggedTestListParser(raw_data) for i in range(len(parser.expectations)): self.assertEqual(parser.expectations[i], expected_outcomes[i])