anchor.diff:      Defs = [{{msg,'Msg'},
                [#field{name=field1, rnum=2, fnum=1, type=uint32,
                        occurrence=required, opts=[]}]}],
  -    {ok, 'X', Code, []} = gpb_compile:msg_defs('X', Defs, [binary]),
  +    M = find_unused_module(),
  +    {ok, M, Code, []} = gpb_compile:msg_defs(M, Defs, [binary]),
       true = is_binary(Code).
   
   mk_fileop_opt(NonDefaults) ->
  
positive.code:                                        occurrence=repeated, opts=[packed]}]}]).
  
  verifies_sequences_test() ->
      Defs = [{{msg,m1}, [#field{name=a, type=int32, occurrence=repeated,
                                 fnum=1, rnum=2, opts=[]}]}],
      {ok, 'X', Code, []} = gpb_compile:msg_defs('X', Defs,
                                                 [binary, {verify, always}]),
      load_code('X',Code),
      <<8,54>> = 'X':encode_msg(#m1{a=[54]}),
      ?assertError({gpb_type_error, _},
                   'X':encode_msg(#m1{a=gurka})).
  
  decode_msg(Bin, MsgName, MsgDefs) ->
      Opts = [binary, {verify, always}],
      {ok, 'X', Code, []} = gpb_compile:msg_defs('X', MsgDefs, Opts),
      load_code('X', Code),
      'X':decode_msg(Bin, MsgName).
  
  load_code(Mod, Code) ->
      delete_old_versions_of_code(Mod),
      {module, Mod} = code:load_binary(Mod, "<nofile>", Code).
  
  delete_old_versions_of_code(Mod) ->
      code:purge(Mod),
      code:delete(Mod),
      code:purge(Mod),
      code:delete(Mod),
      ok.
  
negative.code:                             fnum=1, rnum=2, opts=[]}]},
           {{enum,e}, [{x1, 1}, {x2, 2}]} %% all enum values same encode size
          ],
  
      M1 = compile_defs(CommonDefs++KnownSizeM2),
      M2 = compile_defs(CommonDefs++UnknownSizeM2),
      Msg = #m1{a=#m2{aa=x1, bb=33, cc=44}},
      Encoded1 = M1:encode_msg(Msg),
      Encoded2 = M2:encode_msg(Msg),
      Encoded1 = Encoded2,
      unload_code(M1),
      unload_code(M2).
  
  decodes_overly_long_varints_test() ->
      M = compile_defs([{{msg,m1}, [#field{name=a, type=int32, fnum=1, rnum=#m1.a,
                                           occurrence=required, opts=[]}]}]),
      #m1{a=54} = M:decode_msg(<<8, 54>>, m1), %% canonically encoded
      #m1{a=54} = M:decode_msg(<<8, (128+54), 128, 128, 0>>, m1),
      unload_code(M).
  
  decode_skips_nonpacked_fields_if_wiretype_mismatches_test() ->
      #m1{a=undefined} =
  