OSDN Git Service

PR debug/43329
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / utf8_1.f03
1 ! { dg-do run }
2 ! { dg-options "-fbackslash" }
3 ! Contributed by Jerry DeLisle  <jvdelisle@gcc.gnu.org>
4 program test1
5   implicit none
6   integer, parameter :: k4 = 4
7   character(kind=4, len=30) :: string1, string2
8   character(kind=1, len=30) :: string3
9   string1 = k4_"This is Greek:  \u039f\u03cd\u03c7\u03af"
10   string2 = k4_"Jerry in Japanese is:    \u30b8\u30a8\u30ea\u30fc"
11   open(10, encoding="utf-8", status="scratch")
12   write(10,'(a)') trim(string1)
13   write(10,*) string2
14   rewind(10)
15   string1 = k4_""
16   string2 = k4_""
17   string3 = "abcdefghijklmnopqrstuvwxyz"
18   read(10,'(a)') string1
19   read(10,'(a)') string2
20   if (string1 /= k4_"This is Greek:  \u039f\u03cd\u03c7\u03af") call abort
21   if (len(trim(string1)) /= 20) call abort
22   if (string2 /= k4_" Jerry in Japanese is:    \u30b8\u30a8\u30ea\u30fc")&
23   &  call abort
24   if (len(string2) /= 30) call abort
25   rewind(10)
26   read(10,'(a)') string3
27   if (string3 /= "This is Greek:  ????") call abort
28 end program test1
29 ! The following examples require UTF-8 enabled editor to see correctly.
30 ! ジエリー  Sample of Japanese characters.
31 ! Οὐχὶ    Sample of Greek characters.