I was think about numbers in console (iex) and tests. It’s hard to read bigger numbers.
Of course in tests we have colors for changes (thanks!), but its only for tests and only when comparing results by assert macro.
So here is my proposition:
Environment
- Elixir & Erlang versions (elixir -v):
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10]
Elixir 1.5.0-dev (40c55f3)
Erlang is from portage. Elixir is compiled from source.
- Operating system:
Funtoo Linux (Gentoo based) stable (stage1 setup) with latest updates.
Test code:
defmodule MyApp do
def number_a(), do: 100000
# ...
def number_b(), do: 1000000
end
defmodule MyAppTest do
use ExUnit.Case
doctest MyApp
import MyApp
test "numbers" do
assert number_a() == number_b()
end
end
Current behavior
iex(1)> num = 1_000_000
1000000
iex(2)> IO.puts num
1000000
:ok
iex(3)> IO.inspect num
1000000
1000000
mix test
1) test numbers (MyAppTest)
test/my_app_test.exs:9
Assertion with == failed
code: a == b
lhs: 1000000
rhs: 100000
stacktrace:
test/my_app_test.exs:9: (test)
Finished in 0.1 seconds
2 tests, 1 failure
Expected behavior
iex(1)> num = 1_000_000
1_000_000
iex(2)> IO.puts num
1_000_000
:ok
iex(3)> IO.inspect num
1_000_000
1_000_000
mix test
1) test numbers (MyAppTest)
test/my_app_test.exs:9
Assertion with == failed
code: a == b
lhs: 1_000_000
rhs: 100_000
stacktrace:
test/my_app_test.exs:9: (test)
Finished in 0.1 seconds
2 tests, 1 failure
What do you think about it?