public void Concatenation_Empty() { var element = ReFactory.NewConcatenation(Array.Empty <ReElement>()); Assert.That(element, Is.Not.Null); Assert.That(element, Is.TypeOf(typeof(ReEmptyString))); }
public void Concatenation_Single() { var child = ReUtils.NewDummy('1'); var element = ReFactory.NewConcatenation(new ReElement[] { child }); Assert.That(element, Is.SameAs(element)); }
public void Concatenation_Broken() { var child1 = ReUtils.NewDummy('1'); var child2 = ReUtils.NewDummy('2'); var broke = ReEmptyLanguage.Instance; var element = ReFactory.NewConcatenation(ImmutableArray.Create(child1, broke, child2)); Assert.That(element, Is.SameAs(broke)); }
public void Concatenation_Collapse() { var child1 = ReUtils.NewDummy('1'); var child2 = ReUtils.NewDummy('2'); var child3 = ReUtils.NewDummy('3'); var child4 = ReUtils.NewDummy('4'); var subConcat = new ReConcatenation(ImmutableArray.Create(child2, child3)); var element = ReFactory.NewConcatenation(new ReElement[] { child1, subConcat, ReEmptyString.Instance, child4 }); Assert.That(element, Is.Not.Null); Assert.That(element, Is.TypeOf(typeof(ReConcatenation))); var concat = (ReConcatenation)element; Assert.That(concat.Elements, Is.EquivalentTo(new ReElement[] { child1, child2, child3, child4 })); }