&["a", "b"] が &[&str; 2] なのは良いんだけど,これが &[&str] に暗黙変換されないのが地味にテストケース書く時つらい.明示的に変換するのも &["a", "b"][..] もしくは &["a", "b"] as &[_] でパラメータ化した時に毎回書くのは地味に面倒くさい感じ
Conversation
Notices
-
Embed this notice
ドッグ (linda_pp@mstdn.jp)'s status on Sunday, 12-Nov-2023 18:07:14 JST ドッグ
-
Embed this notice
ドッグ (linda_pp@mstdn.jp)'s status on Sunday, 12-Nov-2023 18:09:22 JST ドッグ
#[derive(Debug)]
struct TestCase {
lines: &'static [&'static str],
}みたいに明示的に構造体を定義して TestCase { lines: &["a", "b"] } みたいに書いたほうが良いのかな(今は横着してタプル使ってる).しかし,パラメータ化したテスト書く時に毎回構造体書くのが地味に面倒ではある
-
Embed this notice