fix(domain): rename from_str to parse on Note and Chord
This commit is contained in:
@@ -60,7 +60,7 @@ impl Note {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_str(s: &str) -> Option<Note> {
|
||||
pub fn parse(s: &str) -> Option<Note> {
|
||||
let (note, consumed) = Self::parse_prefix(s)?;
|
||||
if consumed == s.len() { Some(note) } else { None }
|
||||
}
|
||||
@@ -86,7 +86,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn parse_cb_enharmonic() {
|
||||
assert_eq!(Note::from_str("Cb"), Some(Note::B));
|
||||
assert_eq!(Note::parse("Cb"), Some(Note::B));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -103,9 +103,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn parse_note() {
|
||||
assert_eq!(Note::from_str("F#"), Some(Note::FSharpGFlat));
|
||||
assert_eq!(Note::from_str("Gb"), Some(Note::FSharpGFlat));
|
||||
assert_eq!(Note::from_str("A"), Some(Note::A));
|
||||
assert_eq!(Note::from_str("X"), None);
|
||||
assert_eq!(Note::parse("F#"), Some(Note::FSharpGFlat));
|
||||
assert_eq!(Note::parse("Gb"), Some(Note::FSharpGFlat));
|
||||
assert_eq!(Note::parse("A"), Some(Note::A));
|
||||
assert_eq!(Note::parse("X"), None);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user