distributable:
  url: https://github.com/elixir-lang/elixir/archive/refs/tags/v{{version}}.tar.gz
  strip-components: 1

versions:
  github: elixir-lang/elixir
  strip: /v/

dependencies:
  erlang.org: '*'

build: make install

provides:
  - bin/elixir
  - bin/elixirc
  - bin/iex
  - bin/mix

test:
  script: |
    elixir --version
    mkdir test
    cp $FIXTURE test/test.exs
    cd test
    elixir test.exs

  fixture: |
    whichfizz = fn
      (0, 0, _) -> "FizzBuzz"
      (0, _, _) -> "Fizz"
      (_, 0, _) -> "Buzz"
      (_, _, n) -> n
    end

    fizzbuzz = fn (n) ->
      whichfizz.(rem(n, 3), rem(n, 5), n)
    end

    [1, 2, "Fizz", 4, "Buzz", "Fizz", 7, 8, "Fizz", "Buzz"] = Enum.map(1..10, fizzbuzz)
