Commit graph

14 commits

Author SHA1 Message Date
Michael Miller
f1ce914b73
Better stub DSL tests 2022-04-02 12:07:30 -06:00
Michael Miller
f00ea23c47
Rename stubs_spec.cr to stub_spec.cr 2022-03-31 23:07:08 -06:00
Michael Miller
e05ef94ef5
Initial work on stub DSL - found bug in Crystal compiler
```
Module validation failed: Invalid bitcast
  %4 = bitcast i32* %3 to %"(Spectator::Arguments(T, NT) | Nil)", !dbg !16
 (Exception)
  from /crystal/src/int.cr:541:9 in 'finish'
  from /crystal/src/compiler/crystal/codegen/codegen.cr:71:7 in 'codegen'
  from /crystal/src/compiler/crystal/compiler.cr:173:16 in 'compile'
  from /crystal/src/compiler/crystal/command/spec.cr:98:14 in 'spec'
  from /crystal/src/hash.cr:901:11 in '__crystal_main'
  from /crystal/src/crystal/main.cr:115:5 in 'main'
  from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
Error: you've found a bug in the Crystal compiler. ...
```

I haven't been able to reproduce this in a simplified form.

Passing the `constraint` argument in NullStub#and_return to ValueStub.new triggers the bug.
Removing the `constraint` argument fixes the issue.
2022-03-31 22:49:45 -06:00
Michael Miller
9c1357da3f
Allow passing predefined stubs in as keyword args 2022-03-31 18:55:12 -06:00
Michael Miller
c1195ef687
Simplify macro eval by returning a lazy double 2022-03-31 18:54:39 -06:00
Michael Miller
28ae03d56f
Remove expect_null_double
Workaround no longer needed.
2022-03-25 22:45:13 -06:00
Michael Miller
bed84b315d
Add lazy double 2022-03-19 19:32:41 -06:00
Michael Miller
1657d3577d
Fix test of double name 2022-03-19 18:57:39 -06:00
Michael Miller
0c7f72dc78
Test handling of blocks in doubles 2022-03-19 17:04:51 -06:00
Michael Miller
043ebd818f
Fix argument order 2022-03-19 16:42:14 -06:00
Michael Miller
99aa8afdce
Add as_null_object method 2022-03-19 14:41:45 -06:00
Michael Miller
3fa6baea4d
Test mixing block and keyword stubs 2022-03-19 12:52:23 -06:00
Michael Miller
9091b8d027
Literally inject stubs from double block 2022-03-19 12:28:00 -06:00
Michael Miller
f1daecd25f
Initial spec for double DSL 2022-03-19 11:41:29 -06:00