Skip to content

Commit 0460017

Browse files
committed
Revert keeping of underscores between digits in camelize, closes #10995
1 parent f3b8708 commit 0460017

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lib/elixir/lib/macro.ex

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,9 +1735,6 @@ defmodule Macro do
17351735
defp do_camelize(<<?_, h, t::binary>>) when h >= ?a and h <= ?z,
17361736
do: <<to_upper_char(h)>> <> do_camelize(t)
17371737

1738-
defp do_camelize(<<p, ?_, h, t::binary>>) when p >= ?0 and p <= ?9 and h >= ?0 and h <= ?9,
1739-
do: <<p, ?_, h>> <> do_camelize(t)
1740-
17411738
defp do_camelize(<<?_, h, t::binary>>) when h >= ?0 and h <= ?9, do: <<h>> <> do_camelize(t)
17421739
defp do_camelize(<<?_>>), do: <<>>
17431740
defp do_camelize(<<?/, t::binary>>), do: <<?.>> <> camelize(t)

lib/elixir/test/elixir/macro_test.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,8 @@ defmodule MacroTest do
10361036
assert Macro.camelize("foo__bar") == "FooBar"
10371037
assert Macro.camelize("foo/bar") == "Foo.Bar"
10381038
assert Macro.camelize("Foo.Bar") == "Foo.Bar"
1039-
assert Macro.camelize("foo1_0") == "Foo1_0"
1039+
assert Macro.camelize("foo1_0") == "Foo10"
1040+
assert Macro.camelize("foo_123_4_567") == "Foo1234567"
10401041
assert Macro.camelize("FOO_BAR") == "FOO_BAR"
10411042
assert Macro.camelize("FOO.BAR") == "FOO.BAR"
10421043
assert Macro.camelize("") == ""

0 commit comments

Comments
 (0)