Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tests/standalone/src/io/FileTest.dart

Issue 10035056: Fix a number of editor errors and warnings in io tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // Dart test program for testing file I/O. 5 // Dart test program for testing file I/O.
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 #import("dart:isolate"); 8 #import("dart:isolate");
9 9
10 class MyListOfOneElement implements List { 10 class MyListOfOneElement implements List {
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 } 747 }
748 748
749 // Tests buffer out of bounds exception. 749 // Tests buffer out of bounds exception.
750 static void testBufferOutOfBoundsException() { 750 static void testBufferOutOfBoundsException() {
751 bool exceptionCaught = false; 751 bool exceptionCaught = false;
752 bool wrongExceptionCaught = false; 752 bool wrongExceptionCaught = false;
753 File file = new File(tempDirectory.path + "/out_buffer_out_of_bounds"); 753 File file = new File(tempDirectory.path + "/out_buffer_out_of_bounds");
754 RandomAccessFile openedFile = file.openSync(FileMode.WRITE); 754 RandomAccessFile openedFile = file.openSync(FileMode.WRITE);
755 try { 755 try {
756 List<int> buffer = new List<int>(10); 756 List<int> buffer = new List<int>(10);
757 bool readDone = openedFile.readListSync(buffer, 0, 12); 757 openedFile.readListSync(buffer, 0, 12);
758 } catch (IndexOutOfRangeException ex) { 758 } catch (IndexOutOfRangeException ex) {
759 exceptionCaught = true; 759 exceptionCaught = true;
760 } catch (Exception ex) { 760 } catch (Exception ex) {
761 wrongExceptionCaught = true; 761 wrongExceptionCaught = true;
762 } 762 }
763 Expect.equals(true, exceptionCaught); 763 Expect.equals(true, exceptionCaught);
764 Expect.equals(true, !wrongExceptionCaught); 764 Expect.equals(true, !wrongExceptionCaught);
765 exceptionCaught = false; 765 exceptionCaught = false;
766 try { 766 try {
767 List<int> buffer = new List<int>(10); 767 List<int> buffer = new List<int>(10);
768 bool readDone = openedFile.readListSync(buffer, 6, 6); 768 openedFile.readListSync(buffer, 6, 6);
769 } catch (IndexOutOfRangeException ex) { 769 } catch (IndexOutOfRangeException ex) {
770 exceptionCaught = true; 770 exceptionCaught = true;
771 } catch (Exception ex) { 771 } catch (Exception ex) {
772 wrongExceptionCaught = true; 772 wrongExceptionCaught = true;
773 } 773 }
774 Expect.equals(true, exceptionCaught); 774 Expect.equals(true, exceptionCaught);
775 Expect.equals(true, !wrongExceptionCaught); 775 Expect.equals(true, !wrongExceptionCaught);
776 exceptionCaught = false; 776 exceptionCaught = false;
777 try { 777 try {
778 List<int> buffer = new List<int>(10); 778 List<int> buffer = new List<int>(10);
779 bool readDone = openedFile.readListSync(buffer, -1, 1); 779 openedFile.readListSync(buffer, -1, 1);
780 } catch (IndexOutOfRangeException ex) { 780 } catch (IndexOutOfRangeException ex) {
781 exceptionCaught = true; 781 exceptionCaught = true;
782 } catch (Exception ex) { 782 } catch (Exception ex) {
783 wrongExceptionCaught = true; 783 wrongExceptionCaught = true;
784 } 784 }
785 Expect.equals(true, exceptionCaught); 785 Expect.equals(true, exceptionCaught);
786 Expect.equals(true, !wrongExceptionCaught); 786 Expect.equals(true, !wrongExceptionCaught);
787 exceptionCaught = false; 787 exceptionCaught = false;
788 try { 788 try {
789 List<int> buffer = new List<int>(10); 789 List<int> buffer = new List<int>(10);
790 bool readDone = openedFile.readListSync(buffer, 0, -1); 790 openedFile.readListSync(buffer, 0, -1);
791 } catch (IndexOutOfRangeException ex) { 791 } catch (IndexOutOfRangeException ex) {
792 exceptionCaught = true; 792 exceptionCaught = true;
793 } catch (Exception ex) { 793 } catch (Exception ex) {
794 wrongExceptionCaught = true; 794 wrongExceptionCaught = true;
795 } 795 }
796 Expect.equals(true, exceptionCaught); 796 Expect.equals(true, exceptionCaught);
797 Expect.equals(true, !wrongExceptionCaught); 797 Expect.equals(true, !wrongExceptionCaught);
798 exceptionCaught = false; 798 exceptionCaught = false;
799 try { 799 try {
800 List<int> buffer = new List<int>(10); 800 List<int> buffer = new List<int>(10);
801 bool readDone = openedFile.writeListSync(buffer, 0, 12); 801 openedFile.writeListSync(buffer, 0, 12);
802 } catch (IndexOutOfRangeException ex) { 802 } catch (IndexOutOfRangeException ex) {
803 exceptionCaught = true; 803 exceptionCaught = true;
804 } catch (Exception ex) { 804 } catch (Exception ex) {
805 wrongExceptionCaught = true; 805 wrongExceptionCaught = true;
806 } 806 }
807 Expect.equals(true, exceptionCaught); 807 Expect.equals(true, exceptionCaught);
808 Expect.equals(true, !wrongExceptionCaught); 808 Expect.equals(true, !wrongExceptionCaught);
809 exceptionCaught = false; 809 exceptionCaught = false;
810 try { 810 try {
811 List<int> buffer = new List<int>(10); 811 List<int> buffer = new List<int>(10);
812 bool readDone = openedFile.writeListSync(buffer, 6, 6); 812 openedFile.writeListSync(buffer, 6, 6);
813 } catch (IndexOutOfRangeException ex) { 813 } catch (IndexOutOfRangeException ex) {
814 exceptionCaught = true; 814 exceptionCaught = true;
815 } catch (Exception ex) { 815 } catch (Exception ex) {
816 wrongExceptionCaught = true; 816 wrongExceptionCaught = true;
817 } 817 }
818 Expect.equals(true, exceptionCaught); 818 Expect.equals(true, exceptionCaught);
819 Expect.equals(true, !wrongExceptionCaught); 819 Expect.equals(true, !wrongExceptionCaught);
820 exceptionCaught = false; 820 exceptionCaught = false;
821 try { 821 try {
822 List<int> buffer = new List<int>(10); 822 List<int> buffer = new List<int>(10);
823 bool readDone = openedFile.writeListSync(buffer, -1, 1); 823 openedFile.writeListSync(buffer, -1, 1);
824 } catch (IndexOutOfRangeException ex) { 824 } catch (IndexOutOfRangeException ex) {
825 exceptionCaught = true; 825 exceptionCaught = true;
826 } catch (Exception ex) { 826 } catch (Exception ex) {
827 wrongExceptionCaught = true; 827 wrongExceptionCaught = true;
828 } 828 }
829 Expect.equals(true, exceptionCaught); 829 Expect.equals(true, exceptionCaught);
830 Expect.equals(true, !wrongExceptionCaught); 830 Expect.equals(true, !wrongExceptionCaught);
831 exceptionCaught = false; 831 exceptionCaught = false;
832 try { 832 try {
833 List<int> buffer = new List<int>(10); 833 List<int> buffer = new List<int>(10);
834 bool readDone = openedFile.writeListSync(buffer, 0, -1); 834 openedFile.writeListSync(buffer, 0, -1);
835 } catch (IndexOutOfRangeException ex) { 835 } catch (IndexOutOfRangeException ex) {
836 exceptionCaught = true; 836 exceptionCaught = true;
837 } catch (Exception ex) { 837 } catch (Exception ex) {
838 wrongExceptionCaught = true; 838 wrongExceptionCaught = true;
839 } 839 }
840 Expect.equals(true, exceptionCaught); 840 Expect.equals(true, exceptionCaught);
841 Expect.equals(true, !wrongExceptionCaught); 841 Expect.equals(true, !wrongExceptionCaught);
842 openedFile.closeSync(); 842 openedFile.closeSync();
843 file.deleteSync(); 843 file.deleteSync();
844 } 844 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 testWriteVariousLists(); 1078 testWriteVariousLists();
1079 testDirectory(); 1079 testDirectory();
1080 testDirectorySync(); 1080 testDirectorySync();
1081 }); 1081 });
1082 } 1082 }
1083 } 1083 }
1084 1084
1085 main() { 1085 main() {
1086 FileTest.testMain(); 1086 FileTest.testMain();
1087 } 1087 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698