Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
b6b98f0f
Commit
b6b98f0f
authored
7 years ago
by
Florian Angerer
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Check for next statement after reporting mismatch.
parent
8067f19a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mx.fastr/mx_fastr_pkgs.py
+20
-15
20 additions, 15 deletions
mx.fastr/mx_fastr_pkgs.py
with
20 additions
and
15 deletions
mx.fastr/mx_fastr_pkgs.py
+
20
−
15
View file @
b6b98f0f
...
...
@@ -651,12 +651,12 @@ def _fuzzy_compare(gnur_content, fastr_content, gnur_filename, fastr_filename, v
gnur_prompt
=
_capture_prompt
(
gnur_content
,
gnur_i
)
fastr_prompt
=
_capture_prompt
(
fastr_content
,
fastr_i
)
gnur_cur_statement_start
=
-
1
fastr_cur_statement_start
=
-
1
while
True
:
gnur_line
,
gnur_i
=
_get_next_line
(
gnur_prompt
,
gnur_content
,
gnur_end
,
gnur_i
)
fastr_line
,
fastr_i
=
_get_next_line
(
fastr_prompt
,
fastr_content
,
fastr_len
,
fastr_i
)
gnur_line
,
gnur_i
=
_get_next_line
(
gnur_prompt
,
gnur_content
,
gnur_end
,
gnur_i
)
fastr_line
,
fastr_i
=
_get_next_line
(
fastr_prompt
,
fastr_content
,
fastr_len
,
fastr_i
)
gnur_cur_statement_start
=
gnur_i
fastr_cur_statement_start
=
fastr_i
while
True
:
if
gnur_line
is
None
or
fastr_line
is
None
:
# fail if FastR's output is shorter than GnuR's
if
gnur_line
is
not
None
and
fastr_line
is
None
:
...
...
@@ -665,14 +665,6 @@ def _fuzzy_compare(gnur_content, fastr_content, gnur_filename, fastr_filename, v
overall_result
=
1
break
# check if the current line starts a statement
if
_is_statement_begin
(
gnur_prompt
,
gnur_line
)
and
gnur_cur_statement_start
!=
gnur_i
:
gnur_cur_statement_start
=
gnur_i
# if we find a new statement begin
if
_is_statement_begin
(
fastr_prompt
,
fastr_line
)
and
fastr_cur_statement_start
!=
fastr_i
:
fastr_cur_statement_start
=
fastr_i
# flag indicating that we want to synchronize
sync
=
False
if
gnur_line
!=
fastr_line
:
...
...
@@ -763,6 +755,17 @@ def _fuzzy_compare(gnur_content, fastr_content, gnur_filename, fastr_filename, v
gnur_i
=
gnur_i
+
1
fastr_i
=
fastr_i
+
1
gnur_line
,
gnur_i
=
_get_next_line
(
gnur_prompt
,
gnur_content
,
gnur_end
,
gnur_i
)
fastr_line
,
fastr_i
=
_get_next_line
(
fastr_prompt
,
fastr_content
,
fastr_len
,
fastr_i
)
# check if the current line starts a statement
if
_is_statement_begin
(
gnur_prompt
,
gnur_line
)
and
gnur_cur_statement_start
!=
gnur_i
:
gnur_cur_statement_start
=
gnur_i
# if we find a new statement begin
if
_is_statement_begin
(
fastr_prompt
,
fastr_line
)
and
fastr_cur_statement_start
!=
fastr_i
:
fastr_cur_statement_start
=
fastr_i
return
overall_result
,
len
(
statements_passed
),
len
(
statements_failed
)
...
...
@@ -790,8 +793,10 @@ def _capture_prompt(lines, idx):
def
_is_statement_begin
(
captured_prompt
,
line
):
line_wo_prompt
=
line
.
replace
(
captured_prompt
,
""
).
strip
()
return
line
.
startswith
(
captured_prompt
)
and
line_wo_prompt
is
not
""
and
not
line_wo_prompt
.
startswith
(
"
#
"
)
if
not
line
is
None
:
line_wo_prompt
=
line
.
replace
(
captured_prompt
,
""
).
strip
()
return
line
.
startswith
(
captured_prompt
)
and
line_wo_prompt
is
not
""
and
not
line_wo_prompt
.
startswith
(
"
#
"
)
return
False
def
pkgtest_cmp
(
args
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment