Skip to content

Commit

Permalink
fix: ignore one more line for ghdl out parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
glencoe committed Sep 4, 2023
1 parent f485531 commit c48ec8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions elasticai/creator/vhdl/_ghdl_report_parsing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def parse(text):
lines = text.split("\n")[:-1]
def parse(text: str):
lines = text.split("\n")[:-2]

def split_first_five_colons(line):
all_split = line.split(":")
Expand Down
13 changes: 8 additions & 5 deletions elasticai/creator/vhdl/_ghdl_report_parsing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@


def test_parse_ghdl_simulation_results_one_liner():
simulation_output = "my_test_bench.vhd:64:17:@4ps:(report note):my report message\n"
simulation_output = (
"my_test_bench.vhd:64:17:@4ps:(report note):my report message\nsimulation"
" finished\n"
)
expected = [
{
"source": "my_test_bench.vhd",
Expand All @@ -17,7 +20,7 @@ def test_parse_ghdl_simulation_results_one_liner():


def test_parse_ghdl_another_line():
simulation_output = "A:1:2:@B:(C):D\n"
simulation_output = "A:1:2:@B:(C):D\nsimulation finished\n"
expected = [
{
"source": "A",
Expand All @@ -33,8 +36,8 @@ def test_parse_ghdl_another_line():

def test_parse_two_lines():
simulation_output = (
"source:1:1:@time:(type):content\nsource:1:1:@time:(type):content\nignored last"
" line"
"source:1:1:@time:(type):content\nsource:1:1:@time:(type):content\nignored"
" last line\n"
)
expected = [
{
Expand All @@ -50,5 +53,5 @@ def test_parse_two_lines():


def test_put_colon_content_in_content_field():
simulation_output = "A:1:2:@B:(C):D:e:f\n"
simulation_output = "A:1:2:@B:(C):D:e:f\n\n"
assert "D:e:f" == parse(simulation_output)[0]["content"]

0 comments on commit c48ec8f

Please sign in to comment.