Skip to content

Commit

Permalink
Merge pull request #17 from blackbeam/issue-16
Browse files Browse the repository at this point in the history
Fix Indicator::second() (close #16)
  • Loading branch information
blackbeam authored Sep 2, 2023
2 parents 2a4ead4 + 529aec0 commit 33184b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/indicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Indicator {
///
/// Will panic in case of non-utf8 indicator.
pub fn second(&self) -> &str {
std::str::from_utf8(&self.0[..1]).expect("non-utf8 indicator")
std::str::from_utf8(&self.0[1..]).expect("non-utf8 indicator")
}
}

Expand Down
24 changes: 12 additions & 12 deletions src/xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,17 @@ mod tests {
<marc:leader>00220nam 2200097 i 4500</marc:leader>\
<marc:controlfield tag=\"001\">000000001</marc:controlfield>\
<marc:controlfield tag=\"008\">210128t20212021enka sb 000 0 eng d</marc:controlfield>\
<marc:datafield tag=\"041\" ind1=\"0\" ind2=\"0\">\
<marc:datafield tag=\"041\" ind1=\"0\" ind2=\" \">\
<marc:subfield code=\"a\">eng</marc:subfield>\
</marc:datafield>\
<marc:datafield tag=\"100\" ind1=\"1\" ind2=\"1\">\
<marc:datafield tag=\"100\" ind1=\"1\" ind2=\" \">\
<marc:subfield code=\"a\">Author Name</marc:subfield>\
</marc:datafield>\
<marc:datafield tag=\"245\" ind1=\"0\" ind2=\"0\">\
<marc:subfield code=\"a\">Book title</marc:subfield>\
<marc:subfield code=\"b\">Book Subtitle</marc:subfield>\
</marc:datafield>\
<marc:datafield tag=\"264\" ind1=\" \" ind2=\" \">\
<marc:datafield tag=\"264\" ind1=\" \" ind2=\"1\">\
<marc:subfield code=\"a\">León, Spain</marc:subfield>\
</marc:datafield>\
</marc:record>".to_string();
Expand All @@ -319,16 +319,16 @@ mod tests {
<marc:leader>00220nam 2200097 i 4500</marc:leader>\n \
<marc:controlfield tag=\"001\">000000001</marc:controlfield>\n \
<marc:controlfield tag=\"008\">210128t20212021enka sb 000 0 eng d</marc:controlfield>\n \
<marc:datafield tag=\"041\" ind1=\"0\" ind2=\"0\">\n \
<marc:datafield tag=\"041\" ind1=\"0\" ind2=\" \">\n \
<marc:subfield code=\"a\">eng</marc:subfield>\n \
</marc:datafield>\n <marc:datafield tag=\"100\" ind1=\"1\" ind2=\"1\">\n \
</marc:datafield>\n <marc:datafield tag=\"100\" ind1=\"1\" ind2=\" \">\n \
<marc:subfield code=\"a\">Author Name</marc:subfield>\n \
</marc:datafield>\n \
<marc:datafield tag=\"245\" ind1=\"0\" ind2=\"0\">\n \
<marc:subfield code=\"a\">Book title</marc:subfield>\n \
<marc:subfield code=\"b\">Book Subtitle</marc:subfield>\n \
</marc:datafield>\n \
<marc:datafield tag=\"264\" ind1=\" \" ind2=\" \">\n \
<marc:datafield tag=\"264\" ind1=\" \" ind2=\"1\">\n \
<marc:subfield code=\"a\">León, Spain</marc:subfield>\n \
</marc:datafield>\n\
</marc:record>".to_string();
Expand All @@ -352,17 +352,17 @@ mod tests {
<marc:leader>00220nam 2200097 i 4500</marc:leader>\
<marc:controlfield tag=\"001\">000000001</marc:controlfield>\
<marc:controlfield tag=\"008\">210128t20212021enka sb 000 0 eng d</marc:controlfield>\
<marc:datafield tag=\"041\" ind1=\"0\" ind2=\"0\">\
<marc:datafield tag=\"041\" ind1=\"0\" ind2=\" \">\
<marc:subfield code=\"a\">eng</marc:subfield>\
</marc:datafield>\
<marc:datafield tag=\"100\" ind1=\"1\" ind2=\"1\">\
<marc:datafield tag=\"100\" ind1=\"1\" ind2=\" \">\
<marc:subfield code=\"a\">Author Name</marc:subfield>\
</marc:datafield>\
<marc:datafield tag=\"245\" ind1=\"0\" ind2=\"0\">\
<marc:subfield code=\"a\">Book title</marc:subfield>\
<marc:subfield code=\"b\">Book Subtitle</marc:subfield>\
</marc:datafield>\
<marc:datafield tag=\"264\" ind1=\" \" ind2=\" \">\
<marc:datafield tag=\"264\" ind1=\" \" ind2=\"1\">\
<marc:subfield code=\"a\">León, Spain</marc:subfield>\
</marc:datafield>\
</marc:record>\
Expand All @@ -389,16 +389,16 @@ mod tests {
<marc:leader>00220nam 2200097 i 4500</marc:leader>\n \
<marc:controlfield tag=\"001\">000000001</marc:controlfield>\n \
<marc:controlfield tag=\"008\">210128t20212021enka sb 000 0 eng d</marc:controlfield>\n \
<marc:datafield tag=\"041\" ind1=\"0\" ind2=\"0\">\n \
<marc:datafield tag=\"041\" ind1=\"0\" ind2=\" \">\n \
<marc:subfield code=\"a\">eng</marc:subfield>\n \
</marc:datafield>\n \
<marc:datafield tag=\"100\" ind1=\"1\" ind2=\"1\">\n \
<marc:datafield tag=\"100\" ind1=\"1\" ind2=\" \">\n \
<marc:subfield code=\"a\">Author Name</marc:subfield>\n \
</marc:datafield>\n \
<marc:datafield tag=\"245\" ind1=\"0\" ind2=\"0\">\n \
<marc:subfield code=\"a\">Book title</marc:subfield>\n \
<marc:subfield code=\"b\">Book Subtitle</marc:subfield>\n </marc:datafield>\n \
<marc:datafield tag=\"264\" ind1=\" \" ind2=\" \">\n \
<marc:datafield tag=\"264\" ind1=\" \" ind2=\"1\">\n \
<marc:subfield code=\"a\">León, Spain</marc:subfield>\n \
</marc:datafield>\n \
</marc:record>\n\
Expand Down

0 comments on commit 33184b9

Please sign in to comment.