wolfiton

wolfiton

Koans string problem maybe a bug

I was going though the exercises in http://elixirkoans.io and stumbled upon something odd. even if my code does solve the problem i don’t get a pass.

Exercise:

koan "Be careful, a message may be altered" do
    assert String.replace("An awful day", "awful", "incredible") == String.replace("awful","awful","incredible", global: true)
  end

Console response

Be careful, a message may be altered
Assertion failed in lib/koans/02_strings.ex:23
assert(String.replace("An awful day", "awful", "incredible") == String.replace("awful", "awful", "incredible", global: true))

left:  "An incredible day"
right: "incredible"

The answers they expect can be seen here elixir-koans/test/koans/strings_koan_test.exs at master · elixirkoans/elixir-koans · GitHub and i think is the same thing I am providing.
So why doesn’t my answer get a successful pass?

Thanks

Marked As Solved

wolfiton

wolfiton

Got it! It wanted only the String version of the assertion, in this case “An incredible day”

Where Next?

Popular in Challenges Top

sukhmeetsd
All in all, from what I understand, it is better not to use GenServer.cast when we want some concurrent operations to happen for sure, be...
New
bjorng
Note: This topic is to talk about Day 2 of the Advent of Code 2019 . There is a private leaderboard for elixirforum members. You can joi...
New
New
dominicletz
This topic is about Day 8 of the Advent of Code 2020 . Thanks to @egze, we have a private leaderboard: https://adventofcode.com/2020/le...
New
adamu
Nobody’s doing Advent of Code this year? :grinning_face_with_smiling_eyes: I might do the first week or so. For Day 1, first I solved i...
New
christhekeele
Setting this down for the night, as after a quick naive solve for quick part 1 I realize that part 2 is by design computationally expensi...
New
Aetherus
The second part of today’s puzzle is very misleading. FYI, each of the ghosts has only one possible position that ends with a "Z" on its...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement