Skip to content

Commit ed4ceb6

Browse files
authored
Merge pull request #231 from Gompyn/patch-3
Fix Go test cases
2 parents c08eccf + 2b142a1 commit ed4ceb6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/parser/test_grammar_go.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def test_go_parser3(self):
9797

9898
def test_go_parser4(self):
9999
inc_parser.reset()
100-
partial_code = 'package main\n\nimport (\n\t"encoding/json"\n\t"reflect"\n)\n// You\'re an expert Golang programmer\n// Check if in given list of numbers, are any two numbers closer to each other than\n// given threshold.\n// >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n// False\n// >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n// True\n// \nfunc has_close_elements (numbers []float64, threshold float64) bool {\n\n // 1. '
100+
partial_code = 'package main\n\nimport (\n\t"encoding/json"\n\t"reflect"\n)\n// You\'re an expert Golang programmer\n// Check if in given list of numbers, are any two numbers closer to each other than\n// given threshold.\n// >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n// False\n// >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n// True\n// \nfunc has_close_elements (numbers []float64, threshold float64) bool {\n\n // 1. \n'
101101
res = inc_parser.get_acceptable_next_terminals(partial_code)
102-
self.assertEqual('\n\n // 1. ', res.remainder)
102+
self.assertEqual('// 1. \n', res.remainder)
103103

104104
def test_go_parser5(self):
105105
inc_parser.reset()
@@ -166,14 +166,14 @@ def test_go_parser14(self):
166166
inc_parser.reset()
167167
partial_code = 'package main\n\nimport (\n\t"encoding/json"\n\t"reflect"\n)\n// You\'re an expert Golang programmer\n// Out of list of strings, return the longest one. Return the first one in case of multiple\n// strings of the same length. Return None in case the input list is empty.\n// >>> longest([])\n// \n// >>> longest([\'a\', \'b\', \'c\'])\n// \'a\'\n// >>> longest([\'a\', \'bb\', \'ccc\'])\n// \'ccc\'\n// \nfunc longest (strings []string) interface{} {\n\t'
168168
res = inc_parser.get_acceptable_next_terminals(partial_code)
169-
self.assertIn(AcceptSequence(['EOS', 'IF']), res.accept_sequences)
169+
self.assertIn(AcceptSequence(['NL', 'IF']), res.accept_sequences)
170170

171171
def test_go_parser15(self):
172172
inc_parser.reset()
173173
partial_code = 'package main\n\nimport (\n\t"encoding/json"\n\t"reflect"\n)\nfunc numerical_letter_grade (grades []interface{}) []string {\n\tletter_grades := make([]string, len(grades))\n\tfor i, grade := range grades {\n\t\tswitch grade.('
174174
res = inc_parser.get_acceptable_next_terminals(partial_code)
175175
self.assertIn(AcceptSequence(['LPAR', 'TYPE']), res.accept_sequences)
176-
self.assertIn(AcceptSequence(['LPAR', '__IGNORE_0', 'NAME']), res.accept_sequences)
176+
self.assertIn(AcceptSequence(['LPAR', 'IGNORED', 'NAME']), res.accept_sequences)
177177

178178
def test_go_parser16(self):
179179
inc_parser.reset()

0 commit comments

Comments
 (0)