From 20ad1a6ae63972af4893d4d1f39ba183eeed2891 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 9 Dec 2023 16:29:55 +0800 Subject: [PATCH] Add missing trailing comma. --- .../Parser/Lrc/Lines/LrcLyricParserTest.cs | 4 +- .../Parser/Lrc/Lines/LrcRubyParserTest.cs | 4 +- LrcParser.Tests/Parser/Lrc/LrcParserTest.cs | 212 +++++++++--------- LrcParser.Tests/Parser/LyricParserTest.cs | 2 +- LrcParser/Model/TextIndex.cs | 2 +- LrcParser/Parser/Lrc/Lines/LrcLyricParser.cs | 2 +- LrcParser/Parser/Lrc/LrcParser.cs | 14 +- LrcParser/Utils/TextIndexUtils.cs | 2 +- 8 files changed, 121 insertions(+), 121 deletions(-) diff --git a/LrcParser.Tests/Parser/Lrc/Lines/LrcLyricParserTest.cs b/LrcParser.Tests/Parser/Lrc/Lines/LrcLyricParserTest.cs index cc4b6b2..ce74d18 100644 --- a/LrcParser.Tests/Parser/Lrc/Lines/LrcLyricParserTest.cs +++ b/LrcParser.Tests/Parser/Lrc/Lines/LrcLyricParserTest.cs @@ -33,7 +33,7 @@ public void TestDecode(string lyric, string text, string[] timeTags) var expected = new LrcLyric { Text = text, - TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags) + TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags), }; var actual = Decode(lyric); @@ -51,7 +51,7 @@ public void TestEncode(string text, string[] timeTags, string expected) var lyric = new LrcLyric { Text = text, - TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags) + TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags), }; var actual = Encode(lyric); diff --git a/LrcParser.Tests/Parser/Lrc/Lines/LrcRubyParserTest.cs b/LrcParser.Tests/Parser/Lrc/Lines/LrcRubyParserTest.cs index 8b56263..201975d 100644 --- a/LrcParser.Tests/Parser/Lrc/Lines/LrcRubyParserTest.cs +++ b/LrcParser.Tests/Parser/Lrc/Lines/LrcRubyParserTest.cs @@ -35,7 +35,7 @@ public void TestDecode(string rubyTag, string parent, string ruby, string[] time Ruby = ruby, TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags), StartTime = startTime, - EndTime = endTime + EndTime = endTime, }; var actual = Decode(rubyTag); @@ -59,7 +59,7 @@ public void TestEncode(string parent, string ruby, string[] timeTags, int? start Ruby = ruby, TimeTags = TestCaseTagHelper.ParseTimeTags(timeTags), StartTime = startTime, - EndTime = endTime + EndTime = endTime, }; var actual = Encode(rubyTag); diff --git a/LrcParser.Tests/Parser/Lrc/LrcParserTest.cs b/LrcParser.Tests/Parser/Lrc/LrcParserTest.cs index 70f0d24..bf11e37 100644 --- a/LrcParser.Tests/Parser/Lrc/LrcParserTest.cs +++ b/LrcParser.Tests/Parser/Lrc/LrcParserTest.cs @@ -14,7 +14,7 @@ public void TestDecode() { var lrcText = new[] { - "[00:17:97]帰[00:18:37]り[00:18:55]道[00:18:94]は[00:19:22]" + "[00:17:97]帰[00:18:37]り[00:18:55]道[00:18:94]は[00:19:22]", }; var song = new Song @@ -31,9 +31,9 @@ public void TestDecode() { new TextIndex(2), 18550 }, { new TextIndex(3), 18940 }, { new TextIndex(3, IndexState.End), 19220 }, - } - } - } + }, + }, + }, }; checkDecode(lrcText, song); @@ -47,7 +47,7 @@ public void TestDecodeWithRuby() "[00:01:00]島[00:02:00]島[00:03:00]島[00:04:00]", "@Ruby1=島,しま,,[00:02:00]", "@Ruby2=島,じま,[00:02:00],[00:03:00]", - "@Ruby3=島,とう,[00:03:00]" + "@Ruby3=島,とう,[00:03:00]", }; var song = new Song @@ -70,23 +70,23 @@ public void TestDecodeWithRuby() { Text = "しま", StartCharIndex = 0, - EndCharIndex = 0 + EndCharIndex = 0, }, new() { Text = "じま", StartCharIndex = 1, - EndCharIndex = 1 + EndCharIndex = 1, }, new() { Text = "とう", StartCharIndex = 2, - EndCharIndex = 2 - } - } + EndCharIndex = 2, + }, + }, }, - } + }, }; checkDecode(lrcText, song); @@ -100,7 +100,7 @@ public void TestDecodeWithRubyAndRubyTimeTag() "[00:01:00]島[00:02:00]島[00:03:00]島[00:04:00]", "@Ruby1=島,し[00:00:50]ま,,[00:02:00]", "@Ruby2=島,じ[00:00:50]ま,[00:02:00],[00:03:00]", - "@Ruby3=島,と[00:00:50]う,[00:03:00]" + "@Ruby3=島,と[00:00:50]う,[00:03:00]", }; var song = new Song @@ -124,34 +124,34 @@ public void TestDecodeWithRubyAndRubyTimeTag() Text = "しま", TimeTags = new SortedDictionary { - { new TextIndex(1), 1500 } + { new TextIndex(1), 1500 }, }, StartCharIndex = 0, - EndCharIndex = 0 + EndCharIndex = 0, }, new() { Text = "じま", TimeTags = new SortedDictionary { - { new TextIndex(1), 2500 } + { new TextIndex(1), 2500 }, }, StartCharIndex = 1, - EndCharIndex = 1 + EndCharIndex = 1, }, new() { Text = "とう", TimeTags = new SortedDictionary { - { new TextIndex(1), 3500 } + { new TextIndex(1), 3500 }, }, StartCharIndex = 2, - EndCharIndex = 2 - } - } + EndCharIndex = 2, + }, + }, }, - } + }, }; checkDecode(lrcText, song); @@ -165,7 +165,7 @@ public void TestDecodeWithSameRubyWithDifferentRubyTimeTag() "[00:01:00]島[00:02:00]島[00:03:00]島[00:04:00]", "@Ruby1=島,し[00:00:40]ま,,[00:02:00]", "@Ruby2=島,し[00:00:50]ま,[00:02:00],[00:03:00]", - "@Ruby3=島,し[00:00:60]ま,[00:03:00]" + "@Ruby3=島,し[00:00:60]ま,[00:03:00]", }; var song = new Song @@ -189,34 +189,34 @@ public void TestDecodeWithSameRubyWithDifferentRubyTimeTag() Text = "しま", TimeTags = new SortedDictionary { - { new TextIndex(1), 1400 } + { new TextIndex(1), 1400 }, }, StartCharIndex = 0, - EndCharIndex = 0 + EndCharIndex = 0, }, new() { Text = "しま", TimeTags = new SortedDictionary { - { new TextIndex(1), 2500 } + { new TextIndex(1), 2500 }, }, StartCharIndex = 1, - EndCharIndex = 1 + EndCharIndex = 1, }, new() { Text = "しま", TimeTags = new SortedDictionary { - { new TextIndex(1), 3600 } + { new TextIndex(1), 3600 }, }, StartCharIndex = 2, - EndCharIndex = 2 - } - } + EndCharIndex = 2, + }, + }, }, - } + }, }; checkDecode(lrcText, song); @@ -231,7 +231,7 @@ public void TestDecodeWithNoTimeRangeRuby() "@Ruby1=カ,か", "@Ruby2=ラ,ら", "@Ruby3=オ,お", - "@Ruby4=ケ,け" + "@Ruby4=ケ,け", }; var song = new Song @@ -247,29 +247,29 @@ public void TestDecodeWithNoTimeRangeRuby() { Text = "か", StartCharIndex = 0, - EndCharIndex = 0 + EndCharIndex = 0, }, new() { Text = "ら", StartCharIndex = 1, - EndCharIndex = 1 + EndCharIndex = 1, }, new() { Text = "お", StartCharIndex = 2, - EndCharIndex = 2 + EndCharIndex = 2, }, new() { Text = "け", StartCharIndex = 3, - EndCharIndex = 3 - } - } + EndCharIndex = 3, + }, + }, }, - } + }, }; checkDecode(lrcText, song); @@ -285,7 +285,7 @@ public void TestDecodeWithRubyInDifferentLine() "[00:05:00]島[00:06:00]", "@Ruby1=島,しま,,[00:02:00]", "@Ruby2=島,じま,[00:03:00],[00:04:00]", - "@Ruby3=島,とう,[00:05:00]" + "@Ruby3=島,とう,[00:05:00]", }; var song = new Song @@ -306,9 +306,9 @@ public void TestDecodeWithRubyInDifferentLine() { Text = "しま", StartCharIndex = 0, - EndCharIndex = 0 - } - } + EndCharIndex = 0, + }, + }, }, new() { @@ -324,9 +324,9 @@ public void TestDecodeWithRubyInDifferentLine() { Text = "じま", StartCharIndex = 0, - EndCharIndex = 0 - } - } + EndCharIndex = 0, + }, + }, }, new() { @@ -342,11 +342,11 @@ public void TestDecodeWithRubyInDifferentLine() { Text = "とう", StartCharIndex = 0, - EndCharIndex = 0 - } - } - } - } + EndCharIndex = 0, + }, + }, + }, + }, }; checkDecode(lrcText, song); @@ -359,7 +359,7 @@ public void TestDecodeWithInvalid() var lrcText = new[] { "[00:01:00]島[00:02:00]", - "@Ruby1=島,島" + "@Ruby1=島,島", }; var song = new Song @@ -375,7 +375,7 @@ public void TestDecodeWithInvalid() { new TextIndex(0, IndexState.End), 2000 }, }, }, - } + }, }; checkDecode(lrcText, song); @@ -398,14 +398,14 @@ public void TestEncode() { new TextIndex(2), 18550 }, { new TextIndex(3), 18940 }, { new TextIndex(3, IndexState.End), 19220 }, - } - } - } + }, + }, + }, }; var lrcText = new[] { - "[00:17.97]帰[00:18.37]り[00:18.55]道[00:18.94]は[00:19.22]" + "[00:17.97]帰[00:18.37]り[00:18.55]道[00:18.94]は[00:19.22]", }; checkEncode(song, lrcText); @@ -434,23 +434,23 @@ public void TestEncodeWithRuby() { Text = "しま", StartCharIndex = 0, - EndCharIndex = 0 + EndCharIndex = 0, }, new() { Text = "じま", StartCharIndex = 1, - EndCharIndex = 1 + EndCharIndex = 1, }, new() { Text = "とう", StartCharIndex = 2, - EndCharIndex = 2 - } - } + EndCharIndex = 2, + }, + }, }, - } + }, }; var lrcText = new[] @@ -459,7 +459,7 @@ public void TestEncodeWithRuby() "", "@Ruby1=島,しま,,[00:02.00]", "@Ruby2=島,じま,[00:02.00],[00:03.00]", - "@Ruby3=島,とう,[00:03.00]" + "@Ruby3=島,とう,[00:03.00]", }; checkEncode(song, lrcText); @@ -489,34 +489,34 @@ public void TestEncodeWithRubyAndRubyTimeTag() Text = "しま", TimeTags = new SortedDictionary { - { new TextIndex(1), 1500 } + { new TextIndex(1), 1500 }, }, StartCharIndex = 0, - EndCharIndex = 0 + EndCharIndex = 0, }, new() { Text = "じま", TimeTags = new SortedDictionary { - { new TextIndex(1), 2500 } + { new TextIndex(1), 2500 }, }, StartCharIndex = 1, - EndCharIndex = 1 + EndCharIndex = 1, }, new() { Text = "とう", TimeTags = new SortedDictionary { - { new TextIndex(1), 3500 } + { new TextIndex(1), 3500 }, }, StartCharIndex = 2, - EndCharIndex = 2 - } - } + EndCharIndex = 2, + }, + }, }, - } + }, }; var lrcText = new[] @@ -525,7 +525,7 @@ public void TestEncodeWithRubyAndRubyTimeTag() "", "@Ruby1=島,し[00:00.50]ま,,[00:02.00]", "@Ruby2=島,じ[00:00.50]ま,[00:02.00],[00:03.00]", - "@Ruby3=島,と[00:00.50]う,[00:03.00]" + "@Ruby3=島,と[00:00.50]う,[00:03.00]", }; checkEncode(song, lrcText); @@ -556,20 +556,20 @@ public void TestEncodeWithSameRubyWithDifferentRubyTimeTag() Text = "しま", TimeTags = new SortedDictionary { - { new TextIndex(1), 1400 } + { new TextIndex(1), 1400 }, }, StartCharIndex = 0, - EndCharIndex = 0 + EndCharIndex = 0, }, new() { Text = "しま", TimeTags = new SortedDictionary { - { new TextIndex(1), 2500 } + { new TextIndex(1), 2500 }, }, StartCharIndex = 1, - EndCharIndex = 1 + EndCharIndex = 1, }, new() { @@ -577,10 +577,10 @@ public void TestEncodeWithSameRubyWithDifferentRubyTimeTag() TimeTags = new SortedDictionary { // will merge with second time-tag - { new TextIndex(1), 3500 } + { new TextIndex(1), 3500 }, }, StartCharIndex = 2, - EndCharIndex = 2 + EndCharIndex = 2, }, new() { @@ -588,14 +588,14 @@ public void TestEncodeWithSameRubyWithDifferentRubyTimeTag() TimeTags = new SortedDictionary { // although the relative time is same as the first time-tag, but might not be able to merge. - { new TextIndex(1), 4400 } + { new TextIndex(1), 4400 }, }, StartCharIndex = 3, - EndCharIndex = 3 - } - } + EndCharIndex = 3, + }, + }, }, - } + }, }; var lrcText = new[] @@ -626,29 +626,29 @@ public void TestEncodeWithNoTimeRangeRuby() { Text = "か", StartCharIndex = 0, - EndCharIndex = 0 + EndCharIndex = 0, }, new() { Text = "ら", StartCharIndex = 1, - EndCharIndex = 1 + EndCharIndex = 1, }, new() { Text = "お", StartCharIndex = 2, - EndCharIndex = 2 + EndCharIndex = 2, }, new() { Text = "け", StartCharIndex = 3, - EndCharIndex = 3 - } - } + EndCharIndex = 3, + }, + }, }, - } + }, }; var lrcText = new[] @@ -658,7 +658,7 @@ public void TestEncodeWithNoTimeRangeRuby() "@Ruby1=カ,か", "@Ruby2=ラ,ら", "@Ruby3=オ,お", - "@Ruby4=ケ,け" + "@Ruby4=ケ,け", }; checkEncode(song, lrcText); @@ -685,9 +685,9 @@ public void TestEncodeWithRubyInDifferentLine() { Text = "しま", StartCharIndex = 0, - EndCharIndex = 0 - } - } + EndCharIndex = 0, + }, + }, }, new() { @@ -703,9 +703,9 @@ public void TestEncodeWithRubyInDifferentLine() { Text = "じま", StartCharIndex = 0, - EndCharIndex = 0 - } - } + EndCharIndex = 0, + }, + }, }, new() { @@ -721,11 +721,11 @@ public void TestEncodeWithRubyInDifferentLine() { Text = "とう", StartCharIndex = 0, - EndCharIndex = 0 - } - } - } - } + EndCharIndex = 0, + }, + }, + }, + }, }; var lrcText = new[] @@ -734,7 +734,7 @@ public void TestEncodeWithRubyInDifferentLine() "", "@Ruby1=島,しま,,[00:02.00]", "@Ruby2=島,じま,[00:03.00],[00:04.00]", - "@Ruby3=島,とう,[00:05.00]" + "@Ruby3=島,とう,[00:05.00]", }; checkEncode(song, lrcText); @@ -747,7 +747,7 @@ public void TestEncodeWithEmptyFile() var lrcText = new[] { - "" + "", }; checkEncode(song, lrcText); diff --git a/LrcParser.Tests/Parser/LyricParserTest.cs b/LrcParser.Tests/Parser/LyricParserTest.cs index 050af22..d054498 100644 --- a/LrcParser.Tests/Parser/LyricParserTest.cs +++ b/LrcParser.Tests/Parser/LyricParserTest.cs @@ -52,7 +52,7 @@ protected override Song PostProcess(List values) Lyrics = lines.Select(l => new Lyric { Text = l, - }).ToList() + }).ToList(), }; } diff --git a/LrcParser/Model/TextIndex.cs b/LrcParser/Model/TextIndex.cs index c4cf03d..d1dfb8a 100644 --- a/LrcParser/Model/TextIndex.cs +++ b/LrcParser/Model/TextIndex.cs @@ -73,5 +73,5 @@ public enum IndexState { Start = 0, - End = 1 + End = 1, } diff --git a/LrcParser/Parser/Lrc/Lines/LrcLyricParser.cs b/LrcParser/Parser/Lrc/Lines/LrcLyricParser.cs index 195f8cc..62ded31 100644 --- a/LrcParser/Parser/Lrc/Lines/LrcLyricParser.cs +++ b/LrcParser/Parser/Lrc/Lines/LrcLyricParser.cs @@ -18,7 +18,7 @@ public override LrcLyric Decode(string text) return new LrcLyric { Text = lyric, - TimeTags = timeTags + TimeTags = timeTags, }; } diff --git a/LrcParser/Parser/Lrc/LrcParser.cs b/LrcParser/Parser/Lrc/LrcParser.cs index b8001a5..a2782c3 100644 --- a/LrcParser/Parser/Lrc/LrcParser.cs +++ b/LrcParser/Parser/Lrc/LrcParser.cs @@ -31,8 +31,8 @@ protected override Song PostProcess(List values) { Text = l.Text, TimeTags = getTimeTags(l.TimeTags), - RubyTags = getRubyTags(rubies, l).ToList() - }).ToList() + RubyTags = getRubyTags(rubies, l).ToList(), + }).ToList(), }; static IEnumerable getRubyTags(IEnumerable rubyTags, LrcLyric lyric) @@ -68,7 +68,7 @@ static IEnumerable getRubyTags(IEnumerable rubyTags, LrcLyric Text = rubyTag.Ruby, TimeTags = getTimeTags(rubyTag.TimeTags, startTimeTag.Value), StartCharIndex = startLyricCharIndex, - EndCharIndex = endLyricCharIndex + EndCharIndex = endLyricCharIndex, }; } else @@ -85,7 +85,7 @@ static IEnumerable getRubyTags(IEnumerable rubyTags, LrcLyric Text = rubyTag.Ruby, TimeTags = getTimeTags(rubyTag.TimeTags, startTimeTag.Value), StartCharIndex = convertStartTextIndexToCharIndex(startTimeTag.Key), - EndCharIndex = convertEndTextIndexToCharIndex(endTimeTag.Key) + EndCharIndex = convertEndTextIndexToCharIndex(endTimeTag.Key), }; } } @@ -102,7 +102,7 @@ static int convertEndTextIndexToCharIndex(TextIndex textIndex) => { IndexState.Start => textIndex.Index - 1, IndexState.End => textIndex.Index, - _ => throw new ArgumentOutOfRangeException() + _ => throw new ArgumentOutOfRangeException(), }; } @@ -136,7 +136,7 @@ protected override IEnumerable PreProcess(Song song) .GroupByContinuous(x => new RubyGroup { Ruby = x.Ruby, - TimeTags = x.TimeTags + TimeTags = x.TimeTags, }).ToList(); // then, combine those continuous ruby. @@ -159,7 +159,7 @@ protected override IEnumerable PreProcess(Song song) Parent = parent, TimeTags = timeTags, StartTime = minStartTime, - EndTime = maxEndTime + EndTime = maxEndTime, }; } } diff --git a/LrcParser/Utils/TextIndexUtils.cs b/LrcParser/Utils/TextIndexUtils.cs index 57530d5..a8e130e 100644 --- a/LrcParser/Utils/TextIndexUtils.cs +++ b/LrcParser/Utils/TextIndexUtils.cs @@ -42,6 +42,6 @@ internal static T GetValueByState(TextIndex index, T startValue, T endValue) { IndexState.Start => startValue, IndexState.End => endValue, - _ => throw new ArgumentOutOfRangeException(nameof(index)) + _ => throw new ArgumentOutOfRangeException(nameof(index)), }; }