Skip to content

Commit

Permalink
Verify now creates a file in exercise directory to get same formattin…
Browse files Browse the repository at this point in the history
…g as the normal creation. Other changes based on feedback
  • Loading branch information
meatball133 committed Nov 17, 2024
1 parent 492b44b commit f40f4c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
5 changes: 3 additions & 2 deletions bin/generate
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ parser.on('--verify', 'Verify all exercises') do
exercises.each do |exercise|
if File.exist?("./exercises/practice/#{exercise}/.meta/test_template.erb")
current_code = File.read("./exercises/practice/#{exercise}/#{exercise}_test.rb")
f = Tempfile.create
f = File.new("./exercises/practice/#{exercise}/temp_test.rb", 'w+')
Generator.new(exercise).generate(f.path)
generated_code = f.read
raise VerificationError unless current_code == generated_code
File.delete(f.path)
fail VerificationError unless current_code == generated_code
end
rescue VerificationError => e
$stderr.puts e.message % {exercise:}
Expand Down
3 changes: 1 addition & 2 deletions exercises/practice/acronym/acronym_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def test_punctuation_without_whitespace

def test_very_long_abbreviation
skip
assert_equal 'ROTFLSHTMDCOALM',
Acronym.abbreviate('Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me')
assert_equal 'ROTFLSHTMDCOALM', Acronym.abbreviate('Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me')
end

def test_consecutive_delimiters
Expand Down
12 changes: 6 additions & 6 deletions generatorv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ The script which grabs info from the toml file is quite sensitive, writing the t

Here are some examples of how you should **NOT** work with the toml file.

Make sure that the uuid is the only thing inside of `[uuid]`, if there is, for example, an extra space so would that break it.
Make sure that the UUID is the only thing inside of `[UUID]`, if there is, for example, an extra space so would that break it.
Here is an example

```toml
# This would break it since it is an extra space between uuid and `]`
# This would break it since it is an extra space between UUID and `]`
[1e22cceb-c5e4-4562-9afe-aef07ad1eaf4 ]
# This would break it since it is an extra space between uuid and `[`
# This would break it since it is an extra space between UUID and `[`
[ 1e22cceb-c5e4-4562-9afe-aef07ad1eaf4]
```

The script won't care if you write `include = true` since if it sees the uuid it will always take it as long as `include = false` is not written.
The script won't care if you write `include = true` since if it sees the UUID it will always take it as long as `include = false` is not written.
The script will not work if anything is misspelled, although the part which gets `include = false` doesn't care if it gets an extra space or not.

**NOTE:**
You are also **NOT** allowed to write `include = false` more than once after each uuid.
You are also **NOT** allowed to write `include = false` more than once after each UUID.
Since that can lead to errors in the generator.

Bad way:
Expand Down Expand Up @@ -78,7 +78,7 @@ The template file is written in [Embedded Ruby(ERB)][erb].
ERB enables you to write Ruby code inside of the template file.
It also means that the templates can be highly customizable since you can write any Ruby code you want.

When writing the template file it is recommended to look at already existing template files to get a better understanding of how it works.
When writing the template file, it is recommended to look at already existing template files to get a better understanding of how it works.
The template is getting a slightly modified version of the canonical data, so you can check out the [canonical data][canonical data] to see the data structure.
The modification is that the cases which are not included in the toml file will be removed from the data structure.

Expand Down

0 comments on commit f40f4c4

Please sign in to comment.