| // Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file | |
| // for details. All rights reserved. Use of this source code is governed by a | |
| // BSD-style license that can be found in the LICENSE file. | |
| import 'package:test/test.dart'; | |
| import '../tool/common/src_gen_common.dart'; | |
| void main() { | |
| // Each entity must be decoded exactly once: '<' is the HTML for the | |
| // text '<', so it must not be decoded again to '<'. | |
| const testCases = { | |
| ''': "'", | |
| '"': '"', | |
| '&': '&', | |
| '<': '<', | |
| '>': '>', | |
| '&#39;': ''', | |
| '&quot;': '"', | |
| '&amp;': '&', | |
| '&lt;': '<', | |
| '&gt;': '>', | |
| }; | |
| testCases.forEach((input, expected) { | |
| test('replaceHTMLEntities decodes $input', () { | |
| expect(replaceHTMLEntities(input), expected); | |
| }); | |
| }); | |
| } |