persona-community-5/.pnpm-store/v3/files/71/ff2f6ac965edf754d9f70242da78b8fce9e6bda4898cbfc609127e51aa57614c16ae1cf9143f0c48419b7af48dbee4e9ba7ec16c2ab2ac5ddd0156d2621f39
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

67 lines
1.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { assert } from "chai";
import * as YAML from '../src/';
import * as util from './testUtil';
suite('YAML Syntax', () => {
test('Allow astral characters', function () {
const key = '𝑘𝑒𝑦';
const value = '𝑣𝑎𝑙𝑢𝑒';
const document = YAML.safeLoad(`${key}: ${value}`);
assert.deepEqual(document.mappings[0].key.value, key);
assert.deepEqual(document.mappings[0].value.value, value);
});
test('Forbid non-printable characters', function () {
testErrors('\x01', [{
line: 1,
column: 0,
message:'the stream contains non-printable characters',
isWarning: false
}]);
testErrors('\x7f', [{
line: 1,
column: 0,
message:'the stream contains non-printable characters',
isWarning: false
}]);
testErrors('\x9f', [{
line: 1,
column: 0,
message:'the stream contains non-printable characters',
isWarning: false
}]);
});
test('Forbid lone surrogates', function () {
testErrors('\udc00\ud800', [{
line: 1,
column: 0,
message:'the stream contains non-printable characters',
isWarning: false
}]);
});
test('Allow non-printable characters inside quoted scalars', function () {
const key = '"\x7f\x9f\udc00\ud800"';
const document = YAML.safeLoad(key);
assert.deepEqual(document.value, '\x7f\x9f\udc00\ud800');
});
test('Forbid control sequences inside quoted scalars', function () {
testErrors('"\x03"', [{
line: 0,
column: 2,
message:'expected valid JSON character',
isWarning: false
}]);
});
});
function testErrors(input: string, expectedErrors: util.TestError[]) {
util.testErrors(input, expectedErrors);
}