1#!/usr/bin/env python 2 3# 4# Copyright (C) 2024 The Android Open Source Project 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17# 18 19import sys 20import tempfile 21import unittest 22 23from custom_json import _load_json_with_comment 24 25 26class JsonParseTest(unittest.TestCase): 27 28 def test_json_with_comment(self): 29 self.assertEqual( 30 [], 31 _load_json_with_comment(""" 32 // The line comment can be used in font JSON configuration. 33 [] 34 """), 35 ) 36 37 def test_json_with_comment_double_line_comment(self): 38 self.assertEqual( 39 [], 40 _load_json_with_comment(""" 41 // The double line comment // should work. 42 [] 43 """), 44 ) 45 46 47if __name__ == "__main__": 48 unittest.main(verbosity=2) 49