// ignores eveything inside template {{ <template> }} private State processTemplate(char ch) { switch (ch) { case '}' when buffer.Last() == '}': templateNestingLevel--; if (templateNestingLevel <= 0) { buffer.Discard(); return(State.NormalText); } else { buffer.Add(ch); return(State.Template); } case '{' when buffer.Last() == '{': templateNestingLevel++; buffer.Add(ch); return(State.Template); default: buffer.Add(ch); return(State.Template); } }
public void TemporaryBuffer_Discard() { using var buffer = new TemporaryBuffer <int>(1) { 100, 200, 300 }; buffer.Discard(); Assert.Equal(0, buffer.Count); Assert.Empty(buffer); }
public void TemporaryBuffer_CommitAfterDicard() { using var buffer = new TemporaryBuffer <int>(1) { 100, 200, 300 }; buffer.DiscardLast(); buffer.Add(700); buffer.Add(900); buffer.Discard(); var data = new List <int>(); buffer.Commit(data); Assert.Empty(data); }