Mercurial > hg > graal-compiler
annotate graal/com.oracle.jvmci.options.test/src/com/oracle/jvmci/options/test/TestOptionValue.java @ 21652:5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 12:55:56 +0200 |
parents | b1530a6cce8c |
children |
rev | line source |
---|---|
12672
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
12735
diff
changeset
|
23 package com.oracle.jvmci.options.test; |
12672
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
12735
diff
changeset
|
25 import static com.oracle.jvmci.options.test.TestOptionValue.Options.*; |
12672
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import static org.junit.Assert.*; |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
12735
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
28 import java.util.*; |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
29 |
12672
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import org.junit.*; |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
12735
diff
changeset
|
32 import com.oracle.jvmci.options.*; |
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
12735
diff
changeset
|
33 import com.oracle.jvmci.options.OptionValue.OverrideScope; |
12672
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 public class TestOptionValue { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 public static class Options { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 public static final OptionValue<Boolean> Stable = new StableOptionValue<>(true); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 public static final OptionValue<String> Mutable = new OptionValue<>("original"); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 public static final OptionValue<String> SecondMutable = new OptionValue<>("second"); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 static final OptionDescriptor stable = new OptionDescriptor("Stable", Boolean.class, "", Options.class, "Stable", Stable); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 static final OptionDescriptor mutable = new OptionDescriptor("Mutable", String.class, "", Options.class, "Mutable", Mutable); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 static final OptionDescriptor secondMutable = new OptionDescriptor("SecondMutable", String.class, "", Options.class, "SecondMutable", SecondMutable); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 @Test |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 public void testMutable() { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 assertEquals("original", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 assertEquals("override1", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 assertEquals("override2", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 assertEquals("override1", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 try (OverrideScope s3 = OptionValue.override(Mutable, "override3")) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 assertEquals("override3", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 assertEquals("override1", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 assertEquals("original", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 try (OverrideScope s1 = OptionValue.override(Mutable, "original")) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 assertEquals("original", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 @Test |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 public void testMultiple() { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 assertEquals("original", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 assertEquals("second", SecondMutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 try (OverrideScope s1 = OptionValue.override(Mutable, "override1", SecondMutable, "secondOverride1")) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 assertEquals("override1", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 assertEquals("secondOverride1", SecondMutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 try (OverrideScope s2 = OptionValue.override(Mutable, "override2", SecondMutable, "secondOverride2")) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 assertEquals("override2", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 assertEquals("secondOverride2", SecondMutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 assertEquals("override1", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 assertEquals("secondOverride1", SecondMutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 try (OverrideScope s3 = OptionValue.override(Mutable, "override3", SecondMutable, "secondOverride3")) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 assertEquals("override3", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 assertEquals("secondOverride3", SecondMutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 assertEquals("override1", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 assertEquals("secondOverride1", SecondMutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 assertEquals("original", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 assertEquals("second", SecondMutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 try (OverrideScope s1 = OptionValue.override(Mutable, "original", SecondMutable, "second")) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 assertEquals("original", Mutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 assertEquals("second", SecondMutable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 @Test |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 public void testStable() { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 assertTrue(Stable.getValue()); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 try (OverrideScope s = OptionValue.override(Stable, false)) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 fail("cannot override stable option"); |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 } catch (IllegalArgumentException e) { |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
101 // expected |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 } |
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
103 } |
12735
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
104 |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
105 @Test |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
106 public void toStringTest() { |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
12735
diff
changeset
|
107 assertEquals("com.oracle.jvmci.options.test.TestOptionValue$Options.Mutable=original", Mutable.toString()); |
12735
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
108 try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) { |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
12735
diff
changeset
|
109 assertEquals("com.oracle.jvmci.options.test.TestOptionValue$Options.Mutable=override1", Mutable.toString()); |
12735
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
110 try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) { |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
12735
diff
changeset
|
111 assertEquals("com.oracle.jvmci.options.test.TestOptionValue$Options.Mutable=override2", Mutable.toString()); |
12735
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
112 } |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
113 } |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
114 } |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
115 |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
116 @Test |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
117 public void getValuesTest() { |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
118 assertEquals(Arrays.asList("original"), Mutable.getValues(null)); |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
119 assertEquals(Arrays.asList(true), Stable.getValues(null)); |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
120 try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) { |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
121 assertEquals(Arrays.asList("override1", "original"), Mutable.getValues(null)); |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
122 try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) { |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
123 assertEquals(Arrays.asList("override2", "override1", "original"), Mutable.getValues(null)); |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
124 } |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
125 } |
bb85b81258a0
modified OptionValue.toString() to use the current, possibly overriding value; added OptionValue.getValues()
Doug Simon <doug.simon@oracle.com>
parents:
12672
diff
changeset
|
126 } |
12672
38bf986ce231
added support for scoped overriding of OptionValues (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 } |