-
Notifications
You must be signed in to change notification settings - Fork 107
Default to CRuby for https://try.ruby-lang.org/ #148
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
Conversation
I have attempted it and mentioned it briefly in my last refactoring PR. The tests test the lessons which are, as of now, dependent on Opal idiosyncracies, like a particular syntax of errors. If we switched the default engine for lessons, many of them would stop working. |
The CI shows 25 failures for 117 examples, it doesn't seem too bad. Do you have any idea how to fix that Tutorial step 4 (Putting it differently)? |
Do note, that we only test first 5 examples for non-English languages on CI so it runs faster. I think that the reason is as follows: https://github.com/ruby/TryRuby/blob/master/app/try_ruby.rb#L400
|
This was my theory and it turned out to be correct. But it's quite a bit deeper: As of now: puts "abc"
puts "abc" gives for MRI the following This is for example the lesson "Putting it differently" But this: print "abc\nabc\n" gives for both the following This is for example the lesson "Ready, Aim" The patch I tried: diff --git a/app/try_ruby.rb b/app/try_ruby.rb
index f38351c..9ae90a7 100644
--- a/app/try_ruby.rb
+++ b/app/try_ruby.rb
@@ -397,7 +397,7 @@ class TryRuby
# Do not check the answer if there is no regexp matcher
if @current_item && @current_item.answer
# Get last line of output
- value_to_check = @output_buffer.length > 0 && !@output_buffer.last.empty? ? @output_buffer.last.chomp : ''
+ value_to_check = @output_buffer.join.split("\n").reject(&:empty?).last
# Check if output matches the defined answer regexp
# and print status message This gives us a way forward: we can force the Keep in mind, that this check is done on Opal, and Opal has another incompatibility - the regular expressions have JS semantics, so |
5d91b4a
to
b3ab990
Compare
* That fixes the dropdown order at https://try.ruby-lang.org/playground/ to have the default first.
* Otherwise it's US-ASCII and doesn't display correctly any string with non-ASCII characters, e.g. p "été" becomes "\u00E9t\u00E9".
One nitpick - the JSON files are generated from respective files from |
Ah that's why the CI fails most likely but the specs pass locally, thanks for tip! |
* It's slightly out of sync with translations/ja/*
Is there any reason Maybe it's for convenience of deploying to https://try.ruby-lang.org/ without extra commands in between? |
Now all files should be in sync and the CI should pass. |
Not sure. I agree it makes no sense to keep that.
I'm running the full suite of tests locally and once they pass, I will merge. |
All good. Great work! |
Thanks for review and merging. |
Unfortunately some tests fail, I'm not sure why.
For example, running
bundle exec rake spec
this one fails: