@@ -11,13 +11,13 @@ class ExpanderTest {
1111 fun printsBasicString () {
1212 assertEquals(
1313 " Hello" ,
14- expand(" Hello" , mapOf ()).toString()
14+ expand(" Hello" , mapOf (), false ).toString()
1515 )
1616 }
1717
1818 @Test
1919 fun singleColorIsAdded () {
20- val message = expand(" hi {#red|boo}" , mapOf ())
20+ val message = expand(" hi {#red|boo}" , mapOf (), false )
2121 assertEquals(
2222 " hi " + ChatColor .RED + " boo" + ChatColor .RESET ,
2323 message.toString()
@@ -26,7 +26,7 @@ class ExpanderTest {
2626
2727 @Test
2828 fun embeddedColorsHandled () {
29- val message = expand(" {#green|hello, {#yellow|fred}.} You Stink" , mapOf ())
29+ val message = expand(" {#green|hello, {#yellow|fred}.} You Stink" , mapOf (), false )
3030 assertEquals(
3131 ChatColor .GREEN .toString() + " hello, " + ChatColor .YELLOW + " fred" + ChatColor .GREEN + " ." + ChatColor .RESET + " You Stink" ,
3232 message.toString()
@@ -35,7 +35,7 @@ class ExpanderTest {
3535
3636 @Test
3737 fun argumentArePassed () {
38- val message = expand(" One, {two}, three" , mapOf (Pair (" two" , Message .of(" hello" ))))
38+ val message = expand(" One, {two}, three" , mapOf (Pair (" two" , Message .of(" hello" ))), false )
3939 assertEquals(
4040 " One, hello, three" ,
4141 message.toString()
@@ -54,22 +54,22 @@ class ExpanderTest {
5454 Message .of(" Alex" )
5555 }
5656 })
57- ))
57+ ), false )
5858 assertEquals(" Steve likes Alex" , message.toString())
5959 }
6060
6161 @Test
6262 fun messagesEmbeddedInMessages () {
63- val a = expand(" This is A." , mapOf ())
64- val b = expand(" {a} This is B." , mapOf (Pair (" a" , a)))
65- val c = expand(" {b} This is C." , mapOf (Pair (" b" , b)))
63+ val a = expand(" This is A." , mapOf (), false )
64+ val b = expand(" {a} This is B." , mapOf (Pair (" a" , a)), false )
65+ val c = expand(" {b} This is C." , mapOf (Pair (" b" , b)), false )
6666 assertEquals(" This is A. This is B. This is C." , c.toString())
6767 }
6868
6969 @Test
7070 fun colorsPassedThroughMessages () {
71- val a = expand(" A{#red|B}C" , mapOf ())
72- val b = expand(" {#Green|X{a}Y}" , mapOf (Pair (" a" , a)))
71+ val a = expand(" A{#red|B}C" , mapOf (), false )
72+ val b = expand(" {#Green|X{a}Y}" , mapOf (Pair (" a" , a)), false )
7373 assertEquals(
7474 ChatColor .GREEN .toString() + " XA" + ChatColor .RED + " B" + ChatColor .GREEN + " CY" + ChatColor .RESET ,
7575 b.toString()
@@ -78,8 +78,8 @@ class ExpanderTest {
7878
7979 @Test
8080 fun noCachedDataRemains () {
81- val a = expand(" A{#red|B}C" , mapOf ())
82- val b = expand(" {#Green|X{a}Y}" , mapOf (Pair (" a" , a)))
81+ val a = expand(" A{#red|B}C" , mapOf (), false )
82+ val b = expand(" {#Green|X{a}Y}" , mapOf (Pair (" a" , a)), false )
8383 // run the test a few times with the same objects. If it fails, the cache is broken
8484 for (i in 0 .. 4 )
8585 assertEquals(
@@ -92,7 +92,7 @@ class ExpanderTest {
9292 fun singleMessageThatIsSuperComplex () {
9393 val message = expand(
9494 " Hey, {#bold|Mr. {#Red|Red {#yellow|Bob} the {#yellow|Tob} BANG} BOOM} CRASH" ,
95- mapOf ()
95+ mapOf (), false
9696 )
9797 assertEquals(
9898 " Hey, " + ChatColor .BOLD + " Mr. " + ChatColor .RED + ChatColor .BOLD +
@@ -104,7 +104,7 @@ class ExpanderTest {
104104
105105 @Test
106106 fun multipleFormatsGetApplied () {
107- val message = expand(" Hello, {#bold|{#italic|{#green|World}}}!" , mapOf ())
107+ val message = expand(" Hello, {#bold|{#italic|{#green|World}}}!" , mapOf (), false )
108108 // TODO lazy apply color formats
109109 // note that the bold/italic is applied twice here because the green resets it
110110 assertEquals(" Hello, " + ChatColor .BOLD + ChatColor .ITALIC + ChatColor .GREEN
@@ -116,7 +116,7 @@ class ExpanderTest {
116116
117117 @Test
118118 fun resetDoesResetThings () {
119- val message = expand(" {#Green|{#Bold|Hi {#reset|world}!}}" , mapOf ())
119+ val message = expand(" {#Green|{#Bold|Hi {#reset|world}!}}" , mapOf (), false )
120120 assertEquals(
121121 ChatColor .GREEN .toString() + " " + ChatColor .BOLD + " Hi " + ChatColor .RESET
122122 + " world" + ChatColor .GREEN + ChatColor .BOLD + " !" + ChatColor .GREEN
@@ -126,8 +126,8 @@ class ExpanderTest {
126126
127127 @Test
128128 fun formatCodesThroughMessages () {
129- val a = expand(" {#Green|{#bold|A}}" , mapOf ())
130- val b = expand(" {#Italic|{#Blue|{a}}}" , mapOf (Pair (" a" , a)))
129+ val a = expand(" {#Green|{#bold|A}}" , mapOf (), false )
130+ val b = expand(" {#Italic|{#Blue|{a}}}" , mapOf (Pair (" a" , a)), false )
131131 assertEquals(ChatColor .ITALIC .toString() + " " + ChatColor .BLUE + ChatColor .ITALIC
132132 + ChatColor .GREEN + ChatColor .ITALIC + ChatColor .BOLD + " A" + ChatColor .GREEN
133133 + ChatColor .ITALIC + ChatColor .BLUE + ChatColor .ITALIC + ChatColor .RESET
@@ -137,7 +137,7 @@ class ExpanderTest {
137137
138138 @Test
139139 fun backslashEscapes () {
140- val a = expand(" {#Red|\\ {#Green\\ |Hello\\ {\\ }}" , mapOf ())
140+ val a = expand(" {#Red|\\ {#Green\\ |Hello\\ {\\ }}" , mapOf (), false )
141141 assertEquals(
142142 ChatColor .RED .toString() + " {#Green|Hello{}" + ChatColor .RESET ,
143143 a.toString()
@@ -146,7 +146,7 @@ class ExpanderTest {
146146
147147 @Test
148148 fun testExpandingMissingValueGivesRedHighlight () {
149- val a = expand(" Hello {friend|verb} friend" , mapOf ())
149+ val a = expand(" Hello {friend|verb} friend" , mapOf (), false )
150150 assertEquals(
151151 " Hello " + ChatColor .RED + " {friend|verb}" + ChatColor .RESET + " friend" ,
152152 a.toString()
@@ -159,9 +159,9 @@ class ExpanderTest {
159159 @Test
160160 fun testMessagesLazyExpanded () {
161161 val badExpand = mock(Formattable ::class .java)
162- `when `(badExpand.format(anyList(),)).thenReturn(Message .of(" no no" ))
162+ `when `(badExpand.format(anyList(), anyBoolean() )).thenReturn(Message .of(" no no" ))
163163
164- val a = expand(" {#switch|0|0|choose me|{bad}}" , mapOf (Pair (" bad" , badExpand)))
164+ val a = expand(" {#switch|0|0|choose me|{bad}}" , mapOf (Pair (" bad" , badExpand)), false )
165165
166166 assertEquals(" choose me" , a.toString())
167167 verifyNoInteractions(badExpand)
0 commit comments