OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package formatter | 5 package formatter |
6 | 6 |
7 import ( | 7 import ( |
8 "strings" | 8 "strings" |
9 "testing" | 9 "testing" |
10 ) | 10 ) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 int16 field2@5; | 42 int16 field2@5; |
43 }; | 43 }; |
44 | 44 |
45 enum FooEnum { | 45 enum FooEnum { |
46 VALUE1, // VALUE1 comment. | 46 VALUE1, // VALUE1 comment. |
47 VALUE2 = 10, // VALUE2 comment. | 47 VALUE2 = 10, // VALUE2 comment. |
48 | 48 |
49 // FooEnum Final Comment. | 49 // FooEnum Final Comment. |
50 }; | 50 }; |
51 | 51 |
| 52 // no-format |
| 53 |
| 54 enum SomeWeirdFormat { VALUE1 = 10, VALUE2 = 20}; |
| 55 |
| 56 |
| 57 |
| 58 |
| 59 // end-no-format |
| 60 |
52 // constant comment. | 61 // constant comment. |
53 const int8 foo_constant1 = 10; // constant comment. | 62 const int8 foo_constant1 = 10; // constant comment. |
54 const int8 foo_constant2 = -10; // constant comment. | 63 const int8 foo_constant2 = -10; // constant comment. |
55 const float foo_constant3 = -10e10; // constant comment. | 64 const float foo_constant3 = -10e10; // constant comment. |
56 const int64 foo_constant4 = 0xAD10; // constant comment. | 65 const int64 foo_constant4 = 0xAD10; // constant comment. |
57 const int64 foo_constant5 = -0xAD10; // constant comment. | 66 const int64 foo_constant5 = -0xAD10; // constant comment. |
58 | 67 |
59 // Interface Comment. | 68 // Interface Comment. |
60 interface InterfaceFoo { // Interface comment. | 69 interface InterfaceFoo { // Interface comment. |
61 const int8 const_in_interface = 20; | 70 const int8 const_in_interface = 20; |
(...skipping 19 matching lines...) Expand all Loading... |
81 | 90 |
82 actual, err := FormatMojom("test.mojom", original) | 91 actual, err := FormatMojom("test.mojom", original) |
83 if err != nil { | 92 if err != nil { |
84 t.Fatalf("Parser was not supposed to fail: %s", err.Error()) | 93 t.Fatalf("Parser was not supposed to fail: %s", err.Error()) |
85 } | 94 } |
86 | 95 |
87 if original != actual { | 96 if original != actual { |
88 t.Fatalf("\nExpected:\n%v\n\n*****\n\nActual:\n%v eof", original
, actual) | 97 t.Fatalf("\nExpected:\n%v\n\n*****\n\nActual:\n%v eof", original
, actual) |
89 } | 98 } |
90 } | 99 } |
OLD | NEW |