Beispiel #1
0
        public void TestStringLiterals_DoubleQuotes_spr9620()
        {
            var expr = new SpelExpressionParser().ParseRaw("\"double quote: \"\".\"");

            Assert.Equal("double quote: \".", expr.GetValue());
            expr = new SpelExpressionParser().ParseRaw("\"hello \"\" world\"");
            Assert.Equal("hello \" world", expr.GetValue());
        }
Beispiel #2
0
        public void StringLiterals()
        {
            var expr = new SpelExpressionParser().ParseRaw("'howdy'");

            Assert.Equal("howdy", expr.GetValue());
            expr = new SpelExpressionParser().ParseRaw("'hello '' world'");
            Assert.Equal("hello ' world", expr.GetValue());
        }
Beispiel #3
0
        public void BooleanOperators_symbolic_spr9614()
        {
            var expr = new SpelExpressionParser().ParseRaw("true");

            Assert.True(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("false");
            Assert.False(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("false && false");
            Assert.False(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("true && (true || false)");
            Assert.True(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("true && true || false");
            Assert.True(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("!true");
            Assert.False(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("!(false || true)");
            Assert.False(expr.GetValue <bool>());
        }
Beispiel #4
0
        public void BooleanOperators()
        {
            var expr = new SpelExpressionParser().ParseRaw("true");

            Assert.True(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("false");
            Assert.False(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("false and false");
            Assert.False(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("true and (true or false)");
            Assert.True(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("true and true or false");
            Assert.True(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("!true");
            Assert.False(expr.GetValue <bool>());
            expr = new SpelExpressionParser().ParseRaw("!(false or true)");
            Assert.False(expr.GetValue <bool>());
        }
Beispiel #5
0
        public void StringLiterals2()
        {
            var expr = new SpelExpressionParser().ParseRaw("'howdy'.Substring(0,2)");

            Assert.Equal("ho", expr.GetValue());
        }
Beispiel #6
0
        public void ArithmeticPrecedence6()
        {
            var expr = new SpelExpressionParser().ParseRaw("(3+2)*2");

            Assert.Equal(10, expr.GetValue());
        }
Beispiel #7
0
        public void ArithmeticPrecedence5()
        {
            var expr = new SpelExpressionParser().ParseRaw("(4+10)/2");

            Assert.Equal(7, expr.GetValue());
        }
Beispiel #8
0
        public void ArithmeticPrecedence4()
        {
            var expr = new SpelExpressionParser().ParseRaw("10/2+3");

            Assert.Equal(8, expr.GetValue());
        }