2 ms·
Is there a special reason the tests are all asserting inequality? To me this only indicates if it doesn't do stuff it's not supposed to do, instead of working a
by jrnkntl 11y ago
Is there a special reason the tests are all asserting inequality? To me this only indicates if it doesn't do stuff it's not supposed to do, instead of working as intended: https://github.com/hfiguiere/leftpad-rs/blob/master/src/lib.rs#L29:L39 https://github.com/hfiguiere/leftpad-rs/blob/master/src/lib....
[edit] thanks for the explanation, I'm not familiar with rust and just assumed the bang would mean !=
- thecatspaw 11y agoit doesnt test for inequality. assert_eq! is a macro (indicated by the exclamation mark)
- deleted 11y ago[deleted]
- palmr 11y agoThe assert_eq!() calls are calls to the assert equals macro: https://doc.rust-lang.org/std/macro.assert_eq!.html https://doc.rust-lang.org/std/macro.assert_eq!.html In rust macro functions look like functions but end in a bang(!), it's not using ! to mean negate. http://rustbyexample.com/macros.html http://rustbyexample.com/macros.html
- deskamess 11y agoThe ! indicates that assert_eq is a macro call. Usage example: https://doc.rust-lang.org/std/macro.assert_eq!.html https://doc.rust-lang.org/std/macro.assert_eq!.html