You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/elixir/test/elixir/inspect_test.exs
+21-9Lines changed: 21 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -526,16 +526,20 @@ defmodule Inspect.MapTest do
526
526
# Inspect.Error is raised here when we tried to print the error message
527
527
# called by another exception (Protocol.UndefinedError in this case)
528
528
exception_message=~s'''
529
-
protocol Enumerable not implemented for #Inspect.Error<
530
-
got ArgumentError with message:
529
+
protocol Enumerable not implemented for type Inspect.MapTest.Failing (a struct)
531
530
532
-
"""
533
-
errors were found at the given arguments:
531
+
Got value:
534
532
535
-
* 1st argument: not an atom
536
-
"""
533
+
#Inspect.Error<
534
+
got ArgumentError with message:
537
535
538
-
while inspecting:
536
+
"""
537
+
errors were found at the given arguments:
538
+
539
+
* 1st argument: not an atom
540
+
"""
541
+
542
+
while inspecting:
539
543
540
544
'''
541
545
@@ -926,7 +930,11 @@ defmodule Inspect.CustomProtocolTest do
926
930
got Protocol.UndefinedError with message:
927
931
928
932
"""
929
-
protocol Inspect.CustomProtocolTest.CustomInspect not implemented for %Inspect.CustomProtocolTest.MissingImplementation{} of type Inspect.CustomProtocolTest.MissingImplementation (a struct)
933
+
protocol Inspect.CustomProtocolTest.CustomInspect not implemented for type Inspect.CustomProtocolTest.MissingImplementation (a struct)
@@ -953,7 +961,11 @@ defmodule Inspect.CustomProtocolTest do
953
961
got Protocol.UndefinedError with message:
954
962
955
963
"""
956
-
protocol Inspect.CustomProtocolTest.CustomInspect not implemented for %Inspect.CustomProtocolTest.MissingImplementation{} of type Inspect.CustomProtocolTest.MissingImplementation (a struct)
964
+
protocol Inspect.CustomProtocolTest.CustomInspect not implemented for type Inspect.CustomProtocolTest.MissingImplementation (a struct)
Copy file name to clipboardExpand all lines: lib/elixir/test/elixir/string/chars_test.exs
+24-7Lines changed: 24 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -105,39 +105,54 @@ defmodule String.Chars.ErrorsTest do
105
105
106
106
test"bitstring"do
107
107
message=
108
-
"protocol String.Chars not implemented for <<0, 1::size(4)>> of type BitString, cannot convert a bitstring to a string"
108
+
"""
109
+
protocol String.Chars not implemented for type BitString, cannot convert a bitstring to a string
110
+
111
+
Got value:
112
+
113
+
<<0, 1::size(4)>>
114
+
"""
109
115
110
116
assert_raiseProtocol.UndefinedError,message,fn->
111
117
to_string(<<1::size(12)-integer-signed>>)
112
118
end
113
119
end
114
120
115
121
test"tuple"do
116
-
message="protocol String.Chars not implemented for {1, 2, 3} of type Tuple"
122
+
message="""
123
+
protocol String.Chars not implemented for type Tuple
124
+
125
+
Got value:
126
+
127
+
{1, 2, 3}
128
+
"""
117
129
118
130
assert_raiseProtocol.UndefinedError,message,fn->
119
131
to_string({1,2,3})
120
132
end
121
133
end
122
134
123
135
test"PID"do
124
-
message=~r"^protocol String\.Chars not implemented for #PID<.+?> of type PID$"
136
+
message=
137
+
~r"^protocol String\.Chars not implemented for type PID\n\nGot value:\n\n #PID<.+?>$"
125
138
126
139
assert_raiseProtocol.UndefinedError,message,fn->
127
140
to_string(self())
128
141
end
129
142
end
130
143
131
144
test"ref"do
132
-
message=~r"^protocol String\.Chars not implemented for #Reference<.+?> of type Reference$"
145
+
message=
146
+
~r"^protocol String\.Chars not implemented for type Reference\n\nGot value:\n\n #Reference<.+?>$"
133
147
134
148
assert_raiseProtocol.UndefinedError,message,fn->
135
149
to_string(make_ref())==""
136
150
end
137
151
end
138
152
139
153
test"function"do
140
-
message=~r"^protocol String\.Chars not implemented for #Function<.+?> of type Function$"
154
+
message=
155
+
~r"^protocol String\.Chars not implemented for type Function\n\nGot value:\n\n #Function<.+?>$"
141
156
142
157
assert_raiseProtocol.UndefinedError,message,fn->
143
158
to_string(fn->nilend)
@@ -146,7 +161,9 @@ defmodule String.Chars.ErrorsTest do
146
161
147
162
test"port"do
148
163
[port|_]=Port.list()
149
-
message=~r"^protocol String\.Chars not implemented for #Port<.+?> of type Port$"
164
+
165
+
message=
166
+
~r"^protocol String\.Chars not implemented for type Port\n\nGot value:\n\n #Port<.+?>$"
150
167
151
168
assert_raiseProtocol.UndefinedError,message,fn->
152
169
to_string(port)
@@ -155,7 +172,7 @@ defmodule String.Chars.ErrorsTest do
155
172
156
173
test"user-defined struct"do
157
174
message=
158
-
"protocol String\.Chars not implemented for %String.Chars.ErrorsTest.Foo{foo: \"bar\"} of type String.Chars.ErrorsTest.Foo (a struct)"
175
+
"protocol String\.Chars not implemented for type String.Chars.ErrorsTest.Foo (a struct)\n\nGot value:\n\n %String.Chars.ErrorsTest.Foo{foo: \"bar\"}\n"
0 commit comments