Esempio n. 1
0
        public void Tokenize_BuiltIns01()
        {
            IReadOnlyTextRangeCollection <RToken> tokens = this.Tokenize("require library switch return", new RTokenizer());

            tokens.Should().HaveCount(4);
            foreach (var token in tokens)
            {
                token.Should().HaveType(RTokenType.Identifier).And.HaveSubType(RTokenSubType.BuiltinFunction);
            }
        }
Esempio n. 2
0
        public void Tokenize_BuiltIns02()
        {
            IReadOnlyTextRangeCollection <RToken> tokens = this.Tokenize("require() library() switch() return()", new RTokenizer());

            tokens.Should().HaveCount(12);
            for (var i = 0; i < tokens.Count; i += 3)
            {
                tokens[i].Should().HaveType(RTokenType.Identifier).And.HaveSubType(RTokenSubType.BuiltinFunction);
                tokens[i + 1].Should().HaveType(RTokenType.OpenBrace);
                tokens[i + 2].Should().HaveType(RTokenType.CloseBrace);
            }
        }
Esempio n. 3
0
        public void Tokenize_Missing()
        {
            string s = "NA NA_character_ NA_complex_ NA_integer_ NA_real_";

            IReadOnlyTextRangeCollection <RToken> tokens = this.Tokenize(s, new RTokenizer());

            tokens.Should().HaveCount(5);
            foreach (var token in tokens)
            {
                token.Should().HaveType(RTokenType.Missing).And.HaveSubType(RTokenSubType.BuiltinConstant);
            }
        }