Timeline for How should I write a test for a pure method which doesn't return anything?
Current License: CC BY-SA 3.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 1, 2017 at 20:27 | vote | accept | Arseni Mourzenko | ||
| Feb 1, 2017 at 20:26 | vote | accept | Arseni Mourzenko | ||
| Feb 1, 2017 at 20:26 | |||||
| Feb 1, 2017 at 20:26 | vote | accept | Arseni Mourzenko | ||
| Feb 1, 2017 at 20:26 | |||||
| Feb 1, 2017 at 12:37 | answer | added | Gabriel Robert | timeline score: 1 | |
| Feb 1, 2017 at 12:33 | comment | added | Phoshi | There is one pure function of type unit -> unit in any language which considers unit a standard datatype instead of something magically special-cased. Unfortunately, it just returns unit and does nothing else. | |
| Feb 1, 2017 at 8:17 | answer | added | Paul Kertscher | timeline score: 7 | |
| Feb 1, 2017 at 8:10 | history | tweeted | twitter.com/StackSoftEng/status/826704205129871364 | ||
| Feb 1, 2017 at 7:52 | answer | added | jhyot | timeline score: 1 | |
| Feb 1, 2017 at 1:51 | comment | added | Derek Elkins left SE | @DavidArno More pedantic point, you could have the "do nothing" method (assuming "returns no results" is interpreted as "returns a unit type" which is called void in many languages and has silly rules.) Alternatively, you could have an infinite loop (which works even when "returns no result" really means returns no results. | |
| Jan 31, 2017 at 22:46 | comment | added | Jörg W Mittag | @DavidArno: This is not a pedantic point, it goes right to the heart of the question: the method is hard to test precisely because it is impure. | |
| Jan 31, 2017 at 22:08 | comment | added | David Arno | Pedantic point, but if you have a function that takes no arguments (save for a self reference) and returns no result, it ain't a pure function. | |
| Jan 31, 2017 at 21:53 | answer | added | DeadMG | timeline score: 20 | |
| Jan 31, 2017 at 21:41 | history | edited | Arseni Mourzenko | CC BY-SA 3.0 | added 328 characters in body |
| Jan 31, 2017 at 21:31 | comment | added | gnat | possibly related: How to not test implementation when method returns void? | |
| Jan 31, 2017 at 21:29 | history | asked | Arseni Mourzenko | CC BY-SA 3.0 |