@@ -67,22 +67,6 @@ defmodule Styler.Style.DeprecationsTest do
67
67
assert_style "foo |> List.zip" , "Enum.zip(foo)"
68
68
end
69
69
70
- describe "1.16 deprecations" do
71
- @ describetag skip: Version . match? ( System . version ( ) , "< 1.16.0-dev" )
72
-
73
- test "File.stream!(path, modes, line_or_bytes) to File.stream!(path, line_or_bytes, modes)" do
74
- assert_style (
75
- "File.stream!(path, [encoding: :utf8, trim_bom: true], :line)" ,
76
- "File.stream!(path, :line, encoding: :utf8, trim_bom: true)"
77
- )
78
-
79
- assert_style (
80
- "f |> File.stream!([encoding: :utf8, trim_bom: true], :line) |> Enum.take(2)" ,
81
- "f |> File.stream!(:line, encoding: :utf8, trim_bom: true) |> Enum.take(2)"
82
- )
83
- end
84
- end
85
-
86
70
test "~R is deprecated in favor of ~r" do
87
71
assert_style ( ~s| Regex.match?(~R/foo/, "foo")| , ~s| Regex.match?(~r/foo/, "foo")| )
88
72
end
@@ -131,4 +115,34 @@ defmodule Styler.Style.DeprecationsTest do
131
115
assert_style ( "foo |> bar() |> #{ mod } .slice(x..y)" )
132
116
end
133
117
end
118
+
119
+ describe "1.16+" do
120
+ @ describetag skip: Version . match? ( System . version ( ) , "< 1.16.0-dev" )
121
+
122
+ test "File.stream!(path, modes, line_or_bytes) to File.stream!(path, line_or_bytes, modes)" do
123
+ assert_style (
124
+ "File.stream!(path, [encoding: :utf8, trim_bom: true], :line)" ,
125
+ "File.stream!(path, :line, encoding: :utf8, trim_bom: true)"
126
+ )
127
+
128
+ assert_style (
129
+ "f |> File.stream!([encoding: :utf8, trim_bom: true], :line) |> Enum.take(2)" ,
130
+ "f |> File.stream!(:line, encoding: :utf8, trim_bom: true) |> Enum.take(2)"
131
+ )
132
+ end
133
+ end
134
+
135
+ describe "1.17+" do
136
+ @ describetag skip: Version . match? ( System . version ( ) , "< 1.17.0-dev" )
137
+
138
+ test "to_timeout/1 vs :timer.units(x)" do
139
+ assert_style ":timer.hours(x)" , "to_timeout(hour: x)"
140
+ assert_style ":timer.minutes(x)" , "to_timeout(minute: x)"
141
+ assert_style ":timer.seconds(x)" , "to_timeout(second: x)"
142
+
143
+ assert_style "a |> x() |> :timer.hours()"
144
+ assert_style "a |> x() |> :timer.minutes()"
145
+ assert_style "a |> x() |> :timer.seconds()"
146
+ end
147
+ end
134
148
end
0 commit comments