Exemplo n.º 1
0
        public void SnippetsTest(string snippet, string expected)
        {
            using var source = new Source(snippet);
            var reader = new Reader();

            var(actual, _) = BuiltIn.Eval(reader.Read(source));
            Assert.That(actual.ToString(), Is.EqualTo(expected));
        }
Exemplo n.º 2
0
        public void ShouldThrowTypeErrorException(string snippet, string errorMessage)
        {
            using var source = new Source(snippet);
            var reader = new Reader();
            var obj    = reader.Read(source);

            Assert.That(() => BuiltIn.Eval(obj),
                        Throws.Exception.TypeOf <TypeError>().With.Message.EqualTo(errorMessage));
        }