Skip to content
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

Use JSON.mapping for Generators #95

Closed
bmulvihill opened this issue Nov 2, 2017 · 3 comments
Closed

Use JSON.mapping for Generators #95

bmulvihill opened this issue Nov 2, 2017 · 3 comments
Labels

Comments

@bmulvihill
Copy link
Contributor

I believe we should be using JSON.mapping to simplify our Generator classes and make the code a bit cleaner. We can simply map the canonical_data.json and create our Generator/Test Cases.

Example:

class HelloWorldGenerator < ExerciseGenerator
  JSON.mapping(
    exercise: String,
    version: String,
    cases: Array(HelloWorldTestCase)
  )
end


class HelloWorldTestCase < ExerciseTestCase
  JSON.mapping(
    description: String,
    property: String,
    expected: String
  )

  def workload
    "HelloWorld.hello.should eq(\"#{expected}\")"
  end

  def test_name
    description
  end
end
@mhelmetag
Copy link
Contributor

I saw that in the last PR you made. I think that makes a lot of sense.

I'm all for it!

@stale stale bot added the wontfix label Jan 3, 2018
@exercism exercism deleted a comment from stale bot Jan 3, 2018
@stale stale bot removed the wontfix label Jan 3, 2018
@mhelmetag
Copy link
Contributor

It would be great to make sure all the numeric typing literals (e.g. the _i64 in 1_i64) are removed. Those would probably throw off beginners and just add unnecessary complication.

@mhelmetag
Copy link
Contributor

I believe all generators were updated to use JSON.mapping.

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

No branches or pull requests

2 participants