@@ -2511,5 +2511,96 @@ defmodule Module.Types.DescrTest do
25112511 refute subtype? ( map1 , map2 )
25122512 assert subtype? ( map2 , map1 )
25132513 end
2514+
2515+ test "struct difference" do
2516+ entries =
2517+ [
2518+ closed_map ( __struct__: atom ( [ MapSet ] ) , map: term ( ) ) ,
2519+ closed_map ( __struct__: atom ( [ Jason.OrderedObject ] ) , values: term ( ) ) ,
2520+ closed_map ( __struct__: atom ( [ GenEvent.Stream ] ) , timeout: term ( ) , manager: term ( ) ) ,
2521+ closed_map ( __struct__: atom ( [ HashDict ] ) , size: term ( ) , root: term ( ) ) ,
2522+ closed_map ( __struct__: atom ( [ HashSet ] ) , size: term ( ) , root: term ( ) ) ,
2523+ closed_map (
2524+ __struct__: atom ( [ IO.Stream ] ) ,
2525+ raw: term ( ) ,
2526+ device: term ( ) ,
2527+ line_or_bytes: term ( )
2528+ ) ,
2529+ closed_map ( __struct__: atom ( [ Range ] ) , first: term ( ) , last: term ( ) , step: term ( ) ) ,
2530+ closed_map (
2531+ __struct__: atom ( [ Stream ] ) ,
2532+ enum: term ( ) ,
2533+ done: term ( ) ,
2534+ funs: term ( ) ,
2535+ accs: term ( )
2536+ ) ,
2537+ closed_map (
2538+ __struct__: atom ( [ Req.Response.Async ] ) ,
2539+ pid: term ( ) ,
2540+ ref: term ( ) ,
2541+ stream_fun: term ( ) ,
2542+ cancel_fun: term ( )
2543+ ) ,
2544+ closed_map (
2545+ __struct__: atom ( [ Postgrex.Stream ] ) ,
2546+ options: term ( ) ,
2547+ params: term ( ) ,
2548+ query: term ( ) ,
2549+ conn: term ( )
2550+ ) ,
2551+ closed_map (
2552+ __struct__: atom ( [ DBConnection.PrepareStream ] ) ,
2553+ opts: term ( ) ,
2554+ params: term ( ) ,
2555+ query: term ( ) ,
2556+ conn: term ( )
2557+ ) ,
2558+ closed_map (
2559+ __struct__: atom ( [ DBConnection.Stream ] ) ,
2560+ opts: term ( ) ,
2561+ params: term ( ) ,
2562+ query: term ( ) ,
2563+ conn: term ( )
2564+ ) ,
2565+ closed_map (
2566+ __struct__: atom ( [ Ecto.Adapters.SQL.Stream ] ) ,
2567+ meta: term ( ) ,
2568+ opts: term ( ) ,
2569+ params: term ( ) ,
2570+ statement: term ( )
2571+ ) ,
2572+ closed_map (
2573+ __struct__: atom ( [ Date.Range ] ) ,
2574+ first: term ( ) ,
2575+ last: term ( ) ,
2576+ step: term ( ) ,
2577+ first_in_iso_days: term ( ) ,
2578+ last_in_iso_days: term ( )
2579+ ) ,
2580+ closed_map (
2581+ __struct__: atom ( [ File.Stream ] ) ,
2582+ node: term ( ) ,
2583+ raw: term ( ) ,
2584+ path: term ( ) ,
2585+ modes: term ( ) ,
2586+ line_or_bytes: term ( )
2587+ ) ,
2588+ closed_map (
2589+ __struct__: atom ( [ Phoenix.LiveView.LiveStream ] ) ,
2590+ name: term ( ) ,
2591+ ref: term ( ) ,
2592+ inserts: term ( ) ,
2593+ deletes: term ( ) ,
2594+ reset?: term ( ) ,
2595+ dom_id: term ( ) ,
2596+ consumable?: term ( )
2597+ )
2598+ ]
2599+
2600+ range =
2601+ closed_map ( __struct__: atom ( [ Range ] ) , first: integer ( ) , last: integer ( ) , step: integer ( ) )
2602+
2603+ assert empty? ( difference ( range , Enum . reduce ( entries , & union / 2 ) ) )
2604+ end
25142605 end
25152606end
0 commit comments