@@ -347,53 +347,34 @@ defmodule ProtocolTest do
347347 capture_io ( :stderr , fn ->
348348 defprotocol SampleWithCallbacks do
349349 @ spec with_specs ( any ( ) , keyword ( ) ) :: tuple ( )
350- def with_specs ( term , options \\ [ ] )
350+ def with_specs ( term , options )
351351
352352 @ spec with_specs_and_when ( any ( ) , opts ) :: tuple ( ) when opts: keyword
353- def with_specs_and_when ( term , options \\ [ ] )
353+ def with_specs_and_when ( term , options )
354354
355355 def without_specs ( term , options \\ [ ] )
356356
357357 @ callback foo :: { :ok , term }
358- @ callback foo ( term ) :: { :ok , term }
359- @ callback foo ( term , keyword ) :: { :ok , term , keyword }
360-
361- @ callback foo_when :: { :ok , x } when x: term
362358 @ callback foo_when ( x ) :: { :ok , x } when x: term
363- @ callback foo_when ( x , opts ) :: { :ok , x , opts } when x: term , opts: keyword
364-
365359 @ macrocallback bar ( term ) :: { :ok , term }
366- @ macrocallback bar ( term , keyword ) :: { :ok , term , keyword }
367360
368- @ optional_callbacks [ foo: 1 , foo: 2 ]
361+ @ optional_callbacks [ foo: 0 ]
369362 @ optional_callbacks [ without_specs: 2 ]
370363 end
371364 end )
372365
373366 assert message =~
374- "cannot define @callback foo/0 inside protocol, use def/1 to outline your protocol definition"
375-
376- assert message =~
377- "cannot define @callback foo/1 inside protocol, use def/1 to outline your protocol definition"
378-
379- assert message =~
380- "cannot define @callback foo/2 inside protocol, use def/1 to outline your protocol definition"
367+ "default arguments in protocol definitions is deprecated"
381368
382369 assert message =~
383- "cannot define @callback foo_when /0 inside protocol, use def/1 to outline your protocol definition"
370+ "cannot define @callback foo /0 inside protocol, use def/1 to outline your protocol definition"
384371
385372 assert message =~
386373 "cannot define @callback foo_when/1 inside protocol, use def/1 to outline your protocol definition"
387374
388- assert message =~
389- "cannot define @callback foo_when/2 inside protocol, use def/1 to outline your protocol definition"
390-
391375 assert message =~
392376 "cannot define @macrocallback bar/1 inside protocol, use def/1 to outline your protocol definition"
393377
394- assert message =~
395- "cannot define @macrocallback bar/2 inside protocol, use def/1 to outline your protocol definition"
396-
397378 assert message =~
398379 "cannot define @optional_callbacks inside protocol, all of the protocol definitions are required"
399380 end
0 commit comments