# coding=utf8
"""
Test that C++ supports char8_t correctly.
"""

from __future__ import print_function

import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil


class CxxChar8_tTestCase(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    @skipIf(compiler="clang", compiler_version=['<', '7.0'])
    def test(self):
        """Test that C++ supports char8_t correctly."""
        self.build()
        exe = self.getBuildArtifact("a.out")

        # Create a target by the debugger.
        target = self.dbg.CreateTarget(exe)
        self.assertTrue(target, VALID_TARGET)

        # FIXME: We should be able to test this with target variable, but the
        # data formatter output is broken.
        lldbutil.run_break_set_by_symbol(self, 'main')
        self.runCmd("run", RUN_SUCCEEDED)

        self.expect(
            "frame variable a", substrs=["(char8_t) ::a = 0x61 u8'a'"])

        self.expect(
            "frame variable ab", substrs=['(const char8_t *) ::ab', 'u8"你好"'])

        self.expect(
            "frame variable abc", substrs=['(char8_t [9]) ::abc = u8"你好"'])

# coding=utf8
"""
Test that C++ supports char8_t correctly.
"""

from __future__ import print_function

import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil


class CxxChar8_tTestCase(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    @skipIf(compiler="clang", compiler_version=['<', '7.0'])
    def test(self):
        """Test that C++ supports char8_t correctly."""
        self.build()
        exe = self.getBuildArtifact("a.out")

        # Create a target by the debugger.
        target = self.dbg.CreateTarget(exe)
        self.assertTrue(target, VALID_TARGET)

        # FIXME: We should be able to test this with target variable, but the
        # data formatter output is broken.
        lldbutil.run_break_set_by_symbol(self, 'main')
        self.runCmd("run", RUN_SUCCEEDED)

        self.expect(
            "frame variable a", substrs=["(char8_t)", "0x61 u8'a'"])

        self.expect(
            "frame variable ab", substrs=['(const char8_t *)' , 'u8"你好"'])

        self.expect(
            "frame variable abc", substrs=['(char8_t [9])', 'u8"你好"'])

Update test so it matches the Windows output
[test] Update test so it matches the Windows output

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@369595 91177308-0d34-0410-b5e6-96231b3b80d8
