Commit graph

36 commits

Author SHA1 Message Date
Michael Miller
fe88eefa86
Add inject_mock to DSL 2022-07-12 22:12:48 -06:00
Michael Miller
24eec64d64
Check for leaks on class mocks and doubles 2022-07-12 20:09:18 -06:00
Michael Miller
6e57a1c44a
Allow method calls with unconstrained arguments
Workaround for the expect-receive DSL syntax to allow methods to be called without matching arguments.
2022-07-12 19:23:13 -06:00
Michael Miller
c91e288f61
Add initial support for exect-receive syntax 2022-07-12 19:11:44 -06:00
Michael Miller
3d7655a5d1
Add support for any_args in DSL 2022-07-12 19:05:55 -06:00
Michael Miller
694e2e6259
Initial implementation of have_received 2022-07-11 20:25:15 -06:00
Michael Miller
011ca37b50
Reenable pending tests 2022-07-11 02:59:29 -06:00
Michael Miller
32a9bfd356
Add no_args 2022-07-10 18:51:58 -06:00
Michael Miller
4aaed186c3
Add with stub modifier 2022-07-10 17:31:13 -06:00
Michael Miller
cd177dd2ae
Implement ProcStub 2022-07-10 11:54:51 -06:00
Michael Miller
813983de4b
Implement and test DSL for class mocks and doubles 2022-07-07 19:09:18 -06:00
Michael Miller
c70e4792af
Rename _spectator_calls to _spectator_invocations 2022-06-08 08:18:16 -06:00
Michael Miller
96c7c84275
Test mocked structs 2022-06-01 23:37:54 -06:00
Michael Miller
d289cbff29
Add tests for abstract class mock 2022-06-01 23:13:16 -06:00
Michael Miller
0a710c831a
Test context handling with mocks 2022-06-01 22:23:49 -06:00
Michael Miller
8fbcbe8b73
Test mock scope 2022-06-01 22:11:32 -06:00
Michael Miller
3f4216a271
Allow passing default value stubs to mock initialization 2022-06-01 22:04:18 -06:00
Michael Miller
225553127d
More mock tests 2022-06-01 17:56:09 -06:00
Michael Miller
934c92aed1
More mock DSL tests 2022-05-29 00:28:38 -06:00
Michael Miller
03754321b5
Fix existing mock DSL macros
Initial code for mock DSL.
2022-05-28 09:18:49 -06:00
Michael Miller
670dd7f062
Run smoke test for nightly 2022-05-25 17:20:57 -06:00
Michael Miller
f6f4f9dc1e
Test contexts and memoized values 2022-04-02 15:58:08 -06:00
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