Initial commit
This commit is contained in:
34
elixir/hello-world/.exercism/config.json
Normal file
34
elixir/hello-world/.exercism/config.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"authors": [],
|
||||
"contributors": [
|
||||
"angelikatyborska",
|
||||
"Cohen-Carlisle",
|
||||
"dalexj",
|
||||
"devonestes",
|
||||
"George-Hudson",
|
||||
"hanmd82",
|
||||
"lpil",
|
||||
"neenjaw",
|
||||
"parkerl",
|
||||
"rawkode",
|
||||
"rubysolo",
|
||||
"sotojuan",
|
||||
"Teapane",
|
||||
"Thrillberg",
|
||||
"waiting-for-dev"
|
||||
],
|
||||
"files": {
|
||||
"solution": [
|
||||
"lib/hello_world.ex"
|
||||
],
|
||||
"test": [
|
||||
"test/hello_world_test.exs"
|
||||
],
|
||||
"example": [
|
||||
".meta/example.ex"
|
||||
]
|
||||
},
|
||||
"blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".",
|
||||
"source": "This is an exercise to introduce users to using Exercism",
|
||||
"source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
|
||||
}
|
||||
1
elixir/hello-world/.exercism/metadata.json
Normal file
1
elixir/hello-world/.exercism/metadata.json
Normal file
@@ -0,0 +1 @@
|
||||
{"track":"elixir","exercise":"hello-world","id":"340d85562fad435f8086f4f8ab9cd916","url":"https://exercism.org/tracks/elixir/exercises/hello-world","handle":"negrienko","is_requester":true,"auto_approve":false}
|
||||
4
elixir/hello-world/.formatter.exs
Normal file
4
elixir/hello-world/.formatter.exs
Normal file
@@ -0,0 +1,4 @@
|
||||
# Used by "mix format"
|
||||
[
|
||||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
|
||||
]
|
||||
24
elixir/hello-world/.gitignore
vendored
Normal file
24
elixir/hello-world/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# The directory Mix will write compiled artifacts to.
|
||||
/_build/
|
||||
|
||||
# If you run "mix test --cover", coverage assets end up here.
|
||||
/cover/
|
||||
|
||||
# The directory Mix downloads your dependencies sources to.
|
||||
/deps/
|
||||
|
||||
# Where third-party dependencies like ExDoc output generated docs.
|
||||
/doc/
|
||||
|
||||
# Ignore .fetch files in case you like to edit your project deps locally.
|
||||
/.fetch
|
||||
|
||||
# If the VM crashes, it generates a dump, let's ignore it too.
|
||||
erl_crash.dump
|
||||
|
||||
# Also ignore archive artifacts (built via "mix archive.build").
|
||||
*.ez
|
||||
|
||||
# Ignore package tarball (built via "mix hex.build").
|
||||
hello_world-*.tar
|
||||
|
||||
75
elixir/hello-world/HELP.md
Normal file
75
elixir/hello-world/HELP.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# Help
|
||||
|
||||
## Running the tests
|
||||
|
||||
From the terminal, change to the base directory of the exercise then execute the tests with:
|
||||
|
||||
```bash
|
||||
$ mix test
|
||||
```
|
||||
|
||||
This will execute the test file found in the `test` subfolder -- a file ending in `_test.exs`
|
||||
|
||||
Documentation:
|
||||
|
||||
* [`mix test` - Elixir's test execution tool](https://hexdocs.pm/mix/Mix.Tasks.Test.html)
|
||||
* [`ExUnit` - Elixir's unit test library](https://hexdocs.pm/ex_unit/ExUnit.html)
|
||||
|
||||
## Pending tests
|
||||
|
||||
In test suites of practice exercises, all but the first test have been tagged to be skipped.
|
||||
|
||||
Once you get a test passing, you can unskip the next one by commenting out the relevant `@tag :pending` with a `#` symbol.
|
||||
|
||||
For example:
|
||||
|
||||
```elixir
|
||||
# @tag :pending
|
||||
test "shouting" do
|
||||
assert Bob.hey("WATCH OUT!") == "Whoa, chill out!"
|
||||
end
|
||||
```
|
||||
|
||||
If you wish to run all tests at once, you can include all skipped test by using the `--include` flag on the `mix test` command:
|
||||
|
||||
```bash
|
||||
$ mix test --include pending
|
||||
```
|
||||
|
||||
Or, you can enable all the tests by commenting out the `ExUnit.configure` line in the file `test/test_helper.exs`.
|
||||
|
||||
```elixir
|
||||
# ExUnit.configure(exclude: :pending, trace: true)
|
||||
```
|
||||
|
||||
## Useful `mix test` options
|
||||
|
||||
* `test/<FILE>.exs:LINENUM` - runs only a single test, the test from `<FILE>.exs` whose definition is on line `LINENUM`
|
||||
* `--failed` - runs only tests that failed the last time they ran
|
||||
* `--max-failures` - the suite stops evaluating tests when this number of test failures
|
||||
is reached
|
||||
* `--seed 0` - disables randomization so the tests in a single file will always be ran
|
||||
in the same order they were defined in
|
||||
|
||||
## Submitting your solution
|
||||
|
||||
You can submit your solution using the `exercism submit lib/hello_world.ex` command.
|
||||
This command will upload your solution to the Exercism website and print the solution page's URL.
|
||||
|
||||
It's possible to submit an incomplete solution which allows you to:
|
||||
|
||||
- See how others have completed the exercise
|
||||
- Request help from a mentor
|
||||
|
||||
## Need to get help?
|
||||
|
||||
If you'd like help solving the exercise, check the following pages:
|
||||
|
||||
- The [Elixir track's documentation](https://exercism.org/docs/tracks/elixir)
|
||||
- The [Elixir track's programming category on the forum](https://forum.exercism.org/c/programming/elixir)
|
||||
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5)
|
||||
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)
|
||||
|
||||
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.
|
||||
|
||||
If you're stuck on something, it may help to look at some of the [available resources](https://exercism.org/docs/tracks/elixir/resources) out there where answers might be found.
|
||||
45
elixir/hello-world/README.md
Normal file
45
elixir/hello-world/README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Hello World
|
||||
|
||||
Welcome to Hello World on Exercism's Elixir Track.
|
||||
If you need help running the tests or submitting your code, check out `HELP.md`.
|
||||
|
||||
## Instructions
|
||||
|
||||
The classical introductory exercise.
|
||||
Just say "Hello, World!".
|
||||
|
||||
["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.
|
||||
|
||||
The objectives are simple:
|
||||
|
||||
- Modify the provided code so that it produces the string "Hello, World!".
|
||||
- Run the test suite and make sure that it succeeds.
|
||||
- Submit your solution and check it at the website.
|
||||
|
||||
If everything goes well, you will be ready to fetch your first real exercise.
|
||||
|
||||
[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
|
||||
|
||||
## Source
|
||||
|
||||
### Contributed to by
|
||||
|
||||
- @angelikatyborska
|
||||
- @Cohen-Carlisle
|
||||
- @dalexj
|
||||
- @devonestes
|
||||
- @George-Hudson
|
||||
- @hanmd82
|
||||
- @lpil
|
||||
- @neenjaw
|
||||
- @parkerl
|
||||
- @rawkode
|
||||
- @rubysolo
|
||||
- @sotojuan
|
||||
- @Teapane
|
||||
- @Thrillberg
|
||||
- @waiting-for-dev
|
||||
|
||||
### Based on
|
||||
|
||||
This is an exercise to introduce users to using Exercism - https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
|
||||
9
elixir/hello-world/lib/hello_world.ex
Normal file
9
elixir/hello-world/lib/hello_world.ex
Normal file
@@ -0,0 +1,9 @@
|
||||
defmodule HelloWorld do
|
||||
@doc """
|
||||
Simply returns "Hello, World!"
|
||||
"""
|
||||
@spec hello :: String.t()
|
||||
def hello do
|
||||
"Hello, World!"
|
||||
end
|
||||
end
|
||||
28
elixir/hello-world/mix.exs
Normal file
28
elixir/hello-world/mix.exs
Normal file
@@ -0,0 +1,28 @@
|
||||
defmodule HelloWorld.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
def project do
|
||||
[
|
||||
app: :hello_world,
|
||||
version: "0.1.0",
|
||||
# elixir: "~> 1.8",
|
||||
start_permanent: Mix.env() == :prod,
|
||||
deps: deps()
|
||||
]
|
||||
end
|
||||
|
||||
# Run "mix help compile.app" to learn about applications.
|
||||
def application do
|
||||
[
|
||||
extra_applications: [:logger]
|
||||
]
|
||||
end
|
||||
|
||||
# Run "mix help deps" to learn about dependencies.
|
||||
defp deps do
|
||||
[
|
||||
# {:dep_from_hexpm, "~> 0.3.0"},
|
||||
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
|
||||
]
|
||||
end
|
||||
end
|
||||
7
elixir/hello-world/test/hello_world_test.exs
Normal file
7
elixir/hello-world/test/hello_world_test.exs
Normal file
@@ -0,0 +1,7 @@
|
||||
defmodule HelloWorldTest do
|
||||
use ExUnit.Case
|
||||
|
||||
test "says 'Hello, World!'" do
|
||||
assert HelloWorld.hello() == "Hello, World!"
|
||||
end
|
||||
end
|
||||
2
elixir/hello-world/test/test_helper.exs
Normal file
2
elixir/hello-world/test/test_helper.exs
Normal file
@@ -0,0 +1,2 @@
|
||||
ExUnit.start()
|
||||
ExUnit.configure(exclude: :pending, trace: true)
|
||||
Reference in New Issue
Block a user