public void TwoFigureEntries_good_NotScanningInline() { using (TempSFFileMaker fileMaker = new TempSFFileMaker()) { // Note that ending \fig* is optional even if it is in mapping. string sFilename = fileMaker.CreateFile("ROM", new string[] { @"\c 1", @"\v 1 Hello", @"\fig stuff1|stuff2|stuff3|stuff4|stuff5|stuff6\fig*", @"\new will I be seen?", @"\v 2 I'm a verse, too.", @"\btfig stuff1|stuff2|stuff3|stuff4|stuff5|stuff6\btfig*"}, Encoding.UTF8, false); m_mappingList.Add(new ImportMappingInfo(@"\fig", @"\fig*", false, MappingTargetType.Figure, MarkerDomain.Default, null, null)); ScrImportFileInfo fileInfo = new ScrImportFileInfo(sFilename, m_mappingList, ImportDomain.Main, null, 0, false); m_mappingList.Delete(m_mappingList[@"\new"]); Assert.IsNull(m_mappingList[@"\new"]); // Use strict checking to make sure no error occurs. fileInfo.PerformStrictScan(); Assert.IsNotNull(m_mappingList[@"\new"]); } }
public void FigureEntries_good_WithEndMarker() { using (TempSFFileMaker fileMaker = new TempSFFileMaker()) { // Note that ending \fig* is optional even if it is in mapping. string sFilename = fileMaker.CreateFile("ROM", new string[] { @"\mt Romans", @"\c 1", @"\v 1 Hello", @"\fig stuff1|stuff2|stuff3|stuff4|stuff5|stuff6\fig* etc.", @"\fig stuff1|stuff2|stuff3|stuff4|stuff5|stuff6"}, Encoding.UTF8, false); m_mappingList.Add(new ImportMappingInfo(@"\fig", @"\fig*", false, MappingTargetType.Figure, MarkerDomain.Default, null, null)); ScrImportFileInfo fileInfo = new ScrImportFileInfo(sFilename, m_mappingList, ImportDomain.Main, null, 0, true); // Use strict checking to make sure no error occurs. fileInfo.PerformStrictScan(); } }
public void FigureEntries_good_SplitAcrossLine_LineWithMarkerFollowing() { using (TempSFFileMaker fileMaker = new TempSFFileMaker()) { string sFilename = fileMaker.CreateFile("ROM", new string[] {@"\mt Romans", @"\c 1", @"\v 1 Hello", @"\fig stuff1|stuff2|stuff3|stuff that", @"is for 4|stuff5|stuff6", @"\v 2 This is Paul."}, Encoding.UTF8, false); m_mappingList.Add(new ImportMappingInfo(@"\fig", null, false, MappingTargetType.Figure, MarkerDomain.Default, null, null)); ScrImportFileInfo fileInfo = new ScrImportFileInfo(sFilename, m_mappingList, ImportDomain.Main, null, 0, true); // Use strict checking to make sure no error occurs. fileInfo.PerformStrictScan(); } }
public void DataFileInvalid_NonExcludedMarkersBeforeIdLine() { using (TempSFFileMaker fileMaker = new TempSFFileMaker()) { string sFilename = fileMaker.CreateFileNoID( new string[] {@"\rem Ignore", @"\mt Genesis", @"\id GEN", @"\c 1", @"\v 1 Valid"}); // Try it first without strict checking to make sure it does not throw an exception ScrImportFileInfo fileInfo = new ScrImportFileInfo(sFilename, m_mappingList, ImportDomain.Main, null, 0); // Now use strict checking to make sure the error occurs. try { fileInfo.PerformStrictScan(); Assert.Fail("Failed to throw an exception."); } catch (ScriptureUtilsException e) { Assert.AreEqual(SUE_ErrorCode.UnexcludedDataBeforeIdLine, e.ErrorCode); } } }
public void FigureEntries_bad_tooFewTokens() { using (TempSFFileMaker fileMaker = new TempSFFileMaker()) { string sFilename = fileMaker.CreateFile("ROM", new string[] { @"\mt Romans", @"\c 1", @"\v 1 Hello", @"\fig stuff1|stuff2|stuff3|stuff4|stuff5"}, Encoding.UTF8, false); m_mappingList.Add(new ImportMappingInfo(@"\fig", null, false, MappingTargetType.Figure, MarkerDomain.Default, null, null)); // Try it first without strict checking to make sure it does not throw an exception ScrImportFileInfo fileInfo = new ScrImportFileInfo(sFilename, m_mappingList, ImportDomain.Main, null, 0); try { // Use strict checking to make sure the error occurs. fileInfo.PerformStrictScan(); } catch (ScriptureUtilsException e) { Assert.AreEqual(SUE_ErrorCode.BadFigure, e.ErrorCode); return; } Assert.Fail("The expected exception did not happen"); } }