Skip to content

Extractor cuts out last two lines of test sample code during CI #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
loziniak opened this issue Dec 18, 2022 · 2 comments
Closed

Extractor cuts out last two lines of test sample code during CI #66

loziniak opened this issue Dec 18, 2022 · 2 comments

Comments

@loziniak
Copy link
Member

loziniak commented Dec 18, 2022

(refs #62 )
Hello. I'm trying to sort things out with extractor config for Red. In my simple test a strange thing is going on during CI tests – sample code is truncated by 2 lines for some reason.

https://github.com/exercism/snippet-extractor/actions/runs/3725287654/jobs/6318000198

a log from CI job:

Run options: --seed 5372

# Running:

.......................................................................................F................................................

SimpleCov failed with exit 1rake aborted!
Finished in 0.109589s, 1240.9994 runs/s, 1250.1244 assertions/s.
Command failed with status (1)
/home/runner/work/snippet-extractor/snippet-extractor/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle:23:in `load'
/opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle:23:in `<main>'
Tasks: TOP => test
(See full trace by running task with --trace)

  1) Failure:
SnippetExtractor::Languages::RedTest#test_full_example [/home/runner/work/snippet-extractor/snippet-extractor/test/languages/red_test.rb:47]:
--- expected
+++ actual
@@ -8,6 +8,4 @@
 function add100 [x [integer!]] [
 \t\" this should not count as comment \"
 \t{ and neither
-\t this }
-]
 "


136 runs, 137 assertions, 1 failures, 0 errors, 0 skips
Coverage report generated for Unit Tests to /home/runner/work/snippet-extractor/snippet-extractor/coverage. 871 / 877 LOC (99.32%) covered.
@joshiraez
Copy link
Collaborator

joshiraez commented Dec 19, 2022

It's intentional. The snippet extractor will only get the top 10 lines from the extracted code as it's what fits inside exercism ui (and is a leftover from the basic mode). I thought I implemented an option to increase the number of lines but it was left out of scope. In any case, I should update the Readme stating explicitly that it will only get the first 10 valid lines,

(Technically, the snippet extractor will correctly extract the 12 lines but you can check in the code that only the first 10 lines are then retrieved:

ParseCode.(code, syntax_trie, args)[0...10]
)

loziniak added a commit to loziniak/snippet-extractor that referenced this issue Dec 19, 2022
@loziniak
Copy link
Member Author

Tests now pass OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants