Skip to content

Commit 14efa7a

Browse files
committed
Test string represenations of Line and Message objects
1 parent 7e7ec5d commit 14efa7a

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

.github/workflows/python.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ jobs:
3232
run: |
3333
coverage run --source=panc/src/main/scripts/panlint --omit panc/src/main/scripts/panlint/tests.py panc/src/main/scripts/panlint/tests.py
3434
- name: Report Coverage
35+
env:
36+
TERM: xterm
3537
run: |
3638
coverage report
37-
coverage xml -o ${{ runner.temp }}/python-coverage.xml
38-
- name: Get Cover
39-
uses: orgoro/coverage@v3.2
40-
with:
41-
coverageFile: ${{ runner.temp }}/python-coverage.xml
42-
token: ${{ secrets.GITHUB_TOKEN }}
39+
python3-coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
40+
# Produce a quick and dirty coloured annotation
41+
coverage annotate
42+
sed 's#^!#'"$(tput setaf 1)"'!#' panc/src/main/scripts/panlint/panlint.py,cover |
43+
sed 's#^>#'"$(tput setaf 2)"'>#' |
44+
sed 's#^\([^\\]\)#'"$(tput setaf 7)"'\1#'

panc/src/main/scripts/panlint/tests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ def _assert_lint_line(self, input_line, input_diagnoses, input_messages, input_p
6666
# first_line must ALWAYS be False when returned
6767
self.assertEqual(result_first_line, False)
6868

69+
def test_line_repr(self):
70+
line = panlint.Line('example.pan', 42, ' foo = bar;')
71+
self.assertEqual(str(line), "Line('example.pan', 42, ' foo = bar;')")
72+
73+
def test_message_repr(self):
74+
message = panlint.Message('AB123', 2, 'Example test message')
75+
self.assertEqual(str(message), "Warning: Example test message")
76+
6977
def test_message_ids(self):
7078
line_pattern_ids = [m.id for m in panlint.LINE_PATTERNS.keys()]
7179
line_pattern_ids.sort()

0 commit comments

Comments
 (0)