<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Red Hat. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
import assert = require('assert');
import {parse} from './../src/languageservice/parser/yamlParser07';

suite('Test parser', () => {

    describe('test parser', function () {

            it('parse emtpy text', () => {
                const parsedDocument = parse('');
                assert(parsedDocument.documents.length === 0, 'A document has been created for an empty text');
            });
            
            it('parse single document', () => {
                const parsedDocument = parse('test');
                assert(parsedDocument.documents.length === 1, `A single document should be available but there are ${parsedDocument.documents.length}`);
                assert(parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}`);
            });
            
            it('parse single document with directives', () => {
                const parsedDocument = parse('%TAG demo\n---\ntest');
                assert(parsedDocument.documents.length === 1, `A single document should be available but there are ${parsedDocument.documents.length}`);
                assert(parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}`);
            });
            
            it('parse 2 documents', () => {
                const parsedDocument = parse('test\n---\ntest2');<commit_msg>Add test that a yaml document is created when there is a comment #204<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Red Hat. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
import assert = require('assert');
import {parse} from './../src/languageservice/parser/yamlParser07';

suite('Test parser', () => {

    describe('test parser', function () {

            it('parse emtpy text', () => {
                const parsedDocument = parse('');
                assert(parsedDocument.documents.length === 0, 'A document has been created for an empty text');
            });
            
            it('parse only comment', () => {
                const parsedDocument = parse('# a comment');
                assert(parsedDocument.documents.length === 1, 'No document has been created when there is a comment');
            });
            
            it('parse single document', () => {
                const parsedDocument = parse('test');
                assert(parsedDocument.documents.length === 1, `A single document should be available but there are ${parsedDocument.documents.length}`);
                assert(parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}`);
            });
            
            it('parse single document with directives', () => {
                const parsedDocument = parse('%TAG demo\n---\ntest');
                assert(parsedDocument.documents.length === 1, `A single document should be available but there are ${parsedDocument.documents.length}`);
                assert(parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}`);
            });
            
            it('parse 2 documents', () => {
                const parsedDocument = parse('test\n---\ntest2');
{'fraction_non_alphanumeric': 0.21090637450199204, 'fraction_numerical': 0.007470119521912351, 'mean_word_length': 1.7876474670367801, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5653178', 'n_tokens_mistral': 906, 'n_tokens_neox': 871, 'n_words': 268}