re PR fortran/29277 (Formated stream output: Translate "\n" / achar(10) into "\r...
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 18 Oct 2006 04:08:30 +0000 (04:08 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 18 Oct 2006 04:08:30 +0000 (04:08 +0000)
2006-10-17  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libgfortran/29277
* gfortran.dg/streamio_4.f90: Update test.
* gfortran.dg/streamio_11.f90: New test.

From-SVN: r117847

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/streamio_11.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/streamio_4.f90

index 8e0c054..5080ad4 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-17  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/29277
+       * gfortran.dg/streamio_4.f90: Update test.
+       * gfortran.dg/streamio_11.f90: New test.
+
 2006-10-17  Lee Millward  <lee.millward@codesuorcery.com>
 
         PR c++/27952
diff --git a/gcc/testsuite/gfortran.dg/streamio_11.f90 b/gcc/testsuite/gfortran.dg/streamio_11.f90
new file mode 100644 (file)
index 0000000..2084a23
--- /dev/null
@@ -0,0 +1,43 @@
+! { dg-do run }
+! PR29277 Stream IO test 11, tests formatted form.
+! Contributed by Tobias Burnas.
+program stream_test
+    implicit none
+    character(len=*), parameter :: rec1 = 'record1'
+    character(len=*), parameter :: rec2 = 'record2'
+    character(len=50) :: str1,str2
+    integer           :: len, i
+    real              :: r
+
+    open(10,form='formatted',access='stream',&
+         status='scratch',position='rewind')
+    write(10,'(a)') rec1//new_line('a')//rec2
+    rewind(10)
+    read(10,*) str1
+    read(10,*) str2
+    if(str1 /= rec1 .or. str2 /= rec2) call abort()
+    rewind(10)
+    read(10,'(a)') str1
+    read(10,'(a)') str2
+    if(str1 /= rec1 .or. str2 /= rec2) call abort()
+    close(10)
+
+    open(10,form='formatted',access='stream',&
+         status='scratch',position='rewind')
+    write(10,*) '123 '//trim(rec1)//'  1e-12'
+    write(10,*) '12345.6789'
+    rewind(10)
+    read(10,*) i,str1
+    read(10,*) r
+    if(i /= 123 .or. str1 /= rec1 .or. r /= 12345.6789) &
+      call abort()
+    close(10)
+
+    open(unit=10,form='unformatted',access='stream', &
+         status='scratch',position='rewind')
+    write(10) rec1//new_line('a')//rec2
+    len = len_trim(rec1//new_line('a')//rec2)
+    rewind(10)
+    read(10) str1(1:len)
+    if(str1 /= rec1//new_line('a')//rec2) call abort()
+end program stream_test
index 871bafe..64d2f52 100644 (file)
@@ -15,7 +15,6 @@ program streamtest
     do j=0,9
       write(10,"(i5)") j
     end do
-    write(10,"(a)") lf
   end do
   
   close(10)
@@ -26,7 +25,6 @@ program streamtest
     do j=0,9
       write(10,"(i5)") j
     end do
-    write(10,"(a)") lf
   end do
   rewind(10)
   do i=1,lines
@@ -34,8 +32,6 @@ program streamtest
       read(10,"(i5)") k
       if (k.ne.j) call abort()
     end do
-    read(10,"(a)") tchar
-    if (tchar.ne.lf) call abort()
   end do
 
   close(10,status="delete")