Eiji
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?
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
Adding underscores might be interesting, but I think Elixir 1.4 is adding red/removed and green/add part of comparisons. If it does not do it with numbers then it should with a PR (I think it does it to anything inspectable)?
Qqwy
It definitely is an interesting idea, but I believe it might break a lot of existing (doc)tests.
wojtekmach
Pretty printing integers was considered as addition to Elixir but ultimately it didn’t get through. See this PR: https://github.com/elixir-lang/elixir/pull/4916
Eiji
@wojtekmach: ahhh, one my mistake:
I’m working on one project on github and we have for every smallest change one issue, one PR and one branch (and one card in project).
So I habitually removed only
is:openand searched like:is:issue numbers separator.Also I don’t know that it’s so complicated (I mean I18n part of discussion). I fully agree with decision and its arguments. However it could be a good part of I18n library. I will remember that, because I was think about it (currently I’m working on another secret project and I have hope to release it in this month).
Thanks for all responses!