use fuzzy_dir - #69
Conversation
…e; also refactor it
|
i love your commit messages |
anyway this pr is probably ready |
|
PR #69 and diff +100 -69 |
It's been a long story about me being held hostage by some haskell terrorist but I got out, reevaluated my life choices and killed this stupid fucking 50 chars wide reduce that haunted me for the last week `.reduce(|(hits_acc, misses_acc), (hits, misses)| (hits_acc + hits, misses_acc + misses))` who the fuck wrote this even, it totally wasn't me one week ago trust Also i unironically haven't slept for like 30hrs now lmfao
|
|
||
| #[test] | ||
| fn test_starting_with() { | ||
| assert!(score("test", "t") > score("test", "tt")); |
There was a problem hiding this comment.
test has two tt, why shouldn't it score higher?
There was a problem hiding this comment.
hm, actually ok, fair
I'll replace it with the length of common starting chars instead
There was a problem hiding this comment.
it already worked like that lol
this is because t is contained in test and tt is not
| assert!(score("test abc", "te") > score("test abc", "ta")); | ||
| assert!(score("test_abc", "te") > score("test_abc", "ta")); | ||
|
|
||
| assert!(score("test_abc_a", "te") > score("test_abc_a", "taa")); |
There was a problem hiding this comment.
taa should have more value
my thought process behind this was that if you have multiple words you just type the first letter
"test abc abc" taa
"test uo uo" tuu
but now for both te is better.
ig you could argue that
te and ta for "test abc" can give the same value, but not better imo
| fn test_nonexisting() { | ||
| let env = TempEnv::new(); | ||
| assert!(env.resolve_query("test zzzzzzzzz zzzzzzzzz").is_empty()); | ||
| assert_eq!( |
There was a problem hiding this comment.
Just curious, is there any difference here? Or just readability?
There was a problem hiding this comment.
expected empty vec, found this instead assert_eq error message is more informative than expected vec to be empty, it was not
|
see timothebot/fuzzy_dir#3, i think lacy should just use the library yes |
also refactor it, see diff
fixes #72 (idk how but it does)