Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • api-redesign
  • main
  • 0.10.0
  • 0.10.1
  • 0.10.2
  • 0.7.0
  • 0.8.0
  • 0.8.1
  • 0.9.0
  • 0.9.1
  • 0.9.2
11 results

Target

Select target project
  • justJanne/libquassel
1 result
Select Git revision
  • api-redesign
  • main
  • 0.10.0
  • 0.10.1
  • 0.10.2
  • 0.7.0
  • 0.8.0
  • 0.8.1
  • 0.9.0
  • 0.9.1
  • 0.9.2
11 results
Show changes
Showing with 155 additions and 152 deletions
...@@ -18,7 +18,7 @@ class InsertTest { ...@@ -18,7 +18,7 @@ class InsertTest {
for (i in -1024..1024) { for (i in -1024..1024) {
assertEquals( assertEquals(
listOf(7), listOf(7),
emptyList<Int>().insert(7, i) emptyList<Int>().insert(7, i),
) )
} }
} }
...@@ -28,7 +28,7 @@ class InsertTest { ...@@ -28,7 +28,7 @@ class InsertTest {
for (i in -1024..0) { for (i in -1024..0) {
assertEquals( assertEquals(
listOf(7, 1, 2, 3), listOf(7, 1, 2, 3),
listOf(1, 2, 3).insert(7, i) listOf(1, 2, 3).insert(7, i),
) )
} }
} }
...@@ -38,7 +38,7 @@ class InsertTest { ...@@ -38,7 +38,7 @@ class InsertTest {
for (i in 3..1024) { for (i in 3..1024) {
assertEquals( assertEquals(
listOf(1, 2, 3, 7), listOf(1, 2, 3, 7),
listOf(1, 2, 3).insert(7, i) listOf(1, 2, 3).insert(7, i),
) )
} }
} }
...@@ -47,7 +47,7 @@ class InsertTest { ...@@ -47,7 +47,7 @@ class InsertTest {
fun appendsForNoParameter() { fun appendsForNoParameter() {
assertEquals( assertEquals(
listOf(1, 2, 3, 7), listOf(1, 2, 3, 7),
listOf(1, 2, 3).insert(7) listOf(1, 2, 3).insert(7),
) )
} }
...@@ -55,9 +55,10 @@ class InsertTest { ...@@ -55,9 +55,10 @@ class InsertTest {
fun isEquivalentToMutableAdd() { fun isEquivalentToMutableAdd() {
for (i in -1024..1024) { for (i in -1024..1024) {
val before = listOf(1, 2, 3, 4, 5).shuffled() val before = listOf(1, 2, 3, 4, 5).shuffled()
val afterMutable = before.toMutableList().apply { val afterMutable =
add(i.coerceIn(0..before.size), 7) before.toMutableList().apply {
} add(i.coerceIn(0..before.size), 7)
}
val afterImmutable = before.insert(7, i) val afterImmutable = before.insert(7, i)
assertEquals(afterMutable, afterImmutable) assertEquals(afterMutable, afterImmutable)
} }
......
...@@ -18,7 +18,7 @@ class MoveTest { ...@@ -18,7 +18,7 @@ class MoveTest {
for (i in 6..1024) { for (i in 6..1024) {
assertEquals( assertEquals(
listOf(1, 2, 3, 4, 5, 7), listOf(1, 2, 3, 4, 5, 7),
listOf(1, 2, 7, 3, 4, 5).move(7, i) listOf(1, 2, 7, 3, 4, 5).move(7, i),
) )
} }
} }
...@@ -27,7 +27,7 @@ class MoveTest { ...@@ -27,7 +27,7 @@ class MoveTest {
fun appendsForNoParameter() { fun appendsForNoParameter() {
assertEquals( assertEquals(
listOf(1, 2, 3, 4, 5, 7), listOf(1, 2, 3, 4, 5, 7),
listOf(1, 2, 7, 3, 4, 5).move(7) listOf(1, 2, 7, 3, 4, 5).move(7),
) )
} }
...@@ -36,7 +36,7 @@ class MoveTest { ...@@ -36,7 +36,7 @@ class MoveTest {
for (i in -1024..0) { for (i in -1024..0) {
assertEquals( assertEquals(
listOf(7, 1, 2, 3, 4, 5), listOf(7, 1, 2, 3, 4, 5),
listOf(1, 2, 7, 3, 4, 5).move(7, i) listOf(1, 2, 7, 3, 4, 5).move(7, i),
) )
} }
} }
...@@ -47,7 +47,7 @@ class MoveTest { ...@@ -47,7 +47,7 @@ class MoveTest {
val data = listOf(1, 2, 3, 4, 5, 7).shuffled() val data = listOf(1, 2, 3, 4, 5, 7).shuffled()
assertEquals( assertEquals(
data, data,
data.move(7, data.indexOf(7)) data.move(7, data.indexOf(7)),
) )
} }
} }
...@@ -56,7 +56,7 @@ class MoveTest { ...@@ -56,7 +56,7 @@ class MoveTest {
fun movesCorrectly() { fun movesCorrectly() {
assertEquals( assertEquals(
listOf('a', 'c', 'd', 'e', 'b', 'f'), listOf('a', 'c', 'd', 'e', 'b', 'f'),
listOf('a', 'b', 'c', 'd', 'e', 'f').move('b', 4) listOf('a', 'b', 'c', 'd', 'e', 'f').move('b', 4),
) )
} }
} }
...@@ -15,39 +15,41 @@ import org.junit.jupiter.api.Test ...@@ -15,39 +15,41 @@ import org.junit.jupiter.api.Test
class PairsTest { class PairsTest {
@Test @Test
fun testFunctionality() { fun testFunctionality() {
val list = (0 until 1024).map { val list =
Pair(Math.random(), Math.random()) (0 until 1024).map {
} Pair(Math.random(), Math.random())
}
assertEquals( assertEquals(
list, list,
PairsProxy.call( PairsProxy.call(
list.flatMap { listOf(it.first, it.second) }, list.flatMap { listOf(it.first, it.second) },
::Pair ::Pair,
) ),
) )
assertEquals( assertEquals(
list, list,
list.flatMap { listOf(it.first, it.second) }.pairs() list.flatMap { listOf(it.first, it.second) }.pairs(),
) )
} }
@Test @Test
fun testMalformedPairs() { fun testMalformedPairs() {
val list = (0 until 1024).map { val list =
Pair(Math.random(), Math.random()) (0 until 1024).map {
} Pair(Math.random(), Math.random())
}
assertEquals( assertEquals(
list.subList(0, 256), list.subList(0, 256),
PairsProxy.call( PairsProxy.call(
list.flatMap { listOf(it.first, it.second) } list.flatMap { listOf(it.first, it.second) }
.subList(0, 513), .subList(0, 513),
::Pair ::Pair,
) ),
) )
assertEquals( assertEquals(
list.subList(0, 256), list.subList(0, 256),
list.flatMap { listOf(it.first, it.second) } list.flatMap { listOf(it.first, it.second) }
.subList(0, 513).pairs() .subList(0, 513).pairs(),
) )
} }
} }
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
package de.justjanne.libquassel.protocol.util.collections
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
class RemoveTest {
@Test
fun isEquivalentToMutableRemove() {
for (i in -1024..1024) {
val before = listOf(1, 2, 3, 4, 5).shuffled()
val afterMutable = before.toMutableList().apply {
remove(i)
}
val afterImmutable = before.remove(i)
assertEquals(afterMutable, afterImmutable)
}
}
}
...@@ -18,9 +18,9 @@ class ExpansionTest { ...@@ -18,9 +18,9 @@ class ExpansionTest {
assertEquals( assertEquals(
listOf( listOf(
Expansion.Text("/join "), Expansion.Text("/join "),
Expansion.Parameter(0, null, "$0") Expansion.Parameter(0, null, "$0"),
), ),
Expansion.parse("/join $0") Expansion.parse("/join $0"),
) )
assertEquals( assertEquals(
...@@ -28,9 +28,9 @@ class ExpansionTest { ...@@ -28,9 +28,9 @@ class ExpansionTest {
Expansion.Text("/whois "), Expansion.Text("/whois "),
Expansion.Parameter(0, null, "$0"), Expansion.Parameter(0, null, "$0"),
Expansion.Text(" "), Expansion.Text(" "),
Expansion.Parameter(0, null, "$0") Expansion.Parameter(0, null, "$0"),
), ),
Expansion.parse("/whois $0 $0") Expansion.parse("/whois $0 $0"),
) )
} }
...@@ -39,9 +39,9 @@ class ExpansionTest { ...@@ -39,9 +39,9 @@ class ExpansionTest {
assertEquals( assertEquals(
listOf( listOf(
Expansion.Text("/say Welcome to the support channel for the IRC client Quassel, "), Expansion.Text("/say Welcome to the support channel for the IRC client Quassel, "),
Expansion.Parameter(1, null, "\$1") Expansion.Parameter(1, null, "\$1"),
), ),
Expansion.parse("/say Welcome to the support channel for the IRC client Quassel, \$1") Expansion.parse("/say Welcome to the support channel for the IRC client Quassel, \$1"),
) )
assertEquals( assertEquals(
listOf( listOf(
...@@ -55,7 +55,7 @@ class ExpansionTest { ...@@ -55,7 +55,7 @@ class ExpansionTest {
Expansion.Text(" "), Expansion.Text(" "),
Expansion.Parameter(1, Expansion.ParameterField.IDENT, "\$1:ident"), Expansion.Parameter(1, Expansion.ParameterField.IDENT, "\$1:ident"),
), ),
Expansion.parse("\$1 \$1:account \$1:hostname \$1:identd \$1:ident") Expansion.parse("\$1 \$1:account \$1:hostname \$1:identd \$1:ident"),
) )
} }
...@@ -69,9 +69,9 @@ class ExpansionTest { ...@@ -69,9 +69,9 @@ class ExpansionTest {
Expansion.Constant(Expansion.ConstantField.CHANNEL, "\$channelname"), Expansion.Constant(Expansion.ConstantField.CHANNEL, "\$channelname"),
Expansion.Text(" on "), Expansion.Text(" on "),
Expansion.Constant(Expansion.ConstantField.NETWORK, "\$network"), Expansion.Constant(Expansion.ConstantField.NETWORK, "\$network"),
Expansion.Text(".") Expansion.Text("."),
), ),
Expansion.parse("/say I am \$nick, welcoming you to our channel \$channelname on \$network.") Expansion.parse("/say I am \$nick, welcoming you to our channel \$channelname on \$network."),
) )
assertEquals( assertEquals(
listOf( listOf(
...@@ -79,9 +79,9 @@ class ExpansionTest { ...@@ -79,9 +79,9 @@ class ExpansionTest {
Expansion.Constant(Expansion.ConstantField.NICK, "\$nick"), Expansion.Constant(Expansion.ConstantField.NICK, "\$nick"),
Expansion.Text(" from "), Expansion.Text(" from "),
Expansion.Constant(Expansion.ConstantField.CHANNEL, "\$channel"), Expansion.Constant(Expansion.ConstantField.CHANNEL, "\$channel"),
Expansion.Text(".") Expansion.Text("."),
), ),
Expansion.parse("/say That’s right, I’m /the/ \$nick from \$channel.") Expansion.parse("/say That’s right, I’m /the/ \$nick from \$channel."),
) )
} }
...@@ -99,7 +99,7 @@ class ExpansionTest { ...@@ -99,7 +99,7 @@ class ExpansionTest {
Expansion.ParameterRange(3, null, "\$3.."), Expansion.ParameterRange(3, null, "\$3.."),
Expansion.Text("\""), Expansion.Text("\""),
), ),
Expansion.parse("1 \"\$1\" 2 \"\$2\" 3..4 \"\$3..4\" 3.. \"\$3..\"") Expansion.parse("1 \"\$1\" 2 \"\$2\" 3..4 \"\$3..4\" 3.. \"\$3..\""),
) )
} }
} }
...@@ -40,13 +40,15 @@ class ExpressionMatchTest { ...@@ -40,13 +40,15 @@ class ExpressionMatchTest {
// Phrase with space, case-insensitive // Phrase with space, case-insensitive
val simpleMatchSpace = ExpressionMatch(" space ", ExpressionMatch.MatchMode.MatchPhrase, true) val simpleMatchSpace = ExpressionMatch(" space ", ExpressionMatch.MatchMode.MatchPhrase, true)
// Complex phrase // Complex phrase
val complexMatchFull = """^(?:norm|norm\-space|\!norm\-escaped|\\\!slash\-invert|\\\\double|escape\;""" + val complexMatchFull =
"""sep|slash\-end\-split\\|quad\\\\\!noninvert|newline\-split|newline\-split\-slash\\|slash\-at\-end\\)$""" """^(?:norm|norm\-space|\!norm\-escaped|\\\!slash\-invert|\\\\double|escape\;""" +
val complexMatch = ExpressionMatch( """sep|slash\-end\-split\\|quad\\\\\!noninvert|newline\-split|newline\-split\-slash\\|slash\-at\-end\\)$"""
complexMatchFull, val complexMatch =
ExpressionMatch.MatchMode.MatchPhrase, ExpressionMatch(
false complexMatchFull,
) ExpressionMatch.MatchMode.MatchPhrase,
false,
)
assertEquals("(?:^|\\W)test(?:\\W|$)", simpleMatch.positiveRegex?.pattern) assertEquals("(?:^|\\W)test(?:\\W|$)", simpleMatch.positiveRegex?.pattern)
assertEquals(setOf(RegexOption.IGNORE_CASE), simpleMatch.positiveRegex?.options) assertEquals(setOf(RegexOption.IGNORE_CASE), simpleMatch.positiveRegex?.options)
...@@ -90,27 +92,30 @@ class ExpressionMatchTest { ...@@ -90,27 +92,30 @@ class ExpressionMatchTest {
@Test @Test
fun matchMultiPhrase() { fun matchMultiPhrase() {
// Simple phrases, case-insensitive // Simple phrases, case-insensitive
val simpleMatch = ExpressionMatch( val simpleMatch =
"test\nOther ", ExpressionMatch(
ExpressionMatch.MatchMode.MatchMultiPhrase, "test\nOther ",
false ExpressionMatch.MatchMode.MatchMultiPhrase,
) false,
)
// Simple phrases, case-sensitive // Simple phrases, case-sensitive
val simpleMatchCS = ExpressionMatch( val simpleMatchCS =
"test\nOther ", ExpressionMatch(
ExpressionMatch.MatchMode.MatchMultiPhrase, "test\nOther ",
true ExpressionMatch.MatchMode.MatchMultiPhrase,
) true,
)
// Complex phrases // Complex phrases
val complexMatchFullA = val complexMatchFullA =
"""^(?:norm|norm\-space|\!norm\-escaped|\\\!slash\-invert|\\\\double)|escape\;""" + """^(?:norm|norm\-space|\!norm\-escaped|\\\!slash\-invert|\\\\double)|escape\;""" +
"""sep|slash\-end\-split\\|quad\\\\\!noninvert)|newline\-split|newline\-split\-slash\\|slash\-at\-end\\)$""" """sep|slash\-end\-split\\|quad\\\\\!noninvert)|newline\-split|newline\-split\-slash\\|slash\-at\-end\\)$"""
val complexMatchFullB = """^(?:invert|invert\-space)$)$""" val complexMatchFullB = """^(?:invert|invert\-space)$)$"""
val complexMatch = ExpressionMatch( val complexMatch =
complexMatchFullA + "\n" + complexMatchFullB, ExpressionMatch(
ExpressionMatch.MatchMode.MatchMultiPhrase, complexMatchFullA + "\n" + complexMatchFullB,
false ExpressionMatch.MatchMode.MatchMultiPhrase,
) false,
)
// Assert valid and not empty // Assert valid and not empty
assertFalse(simpleMatch.isEmpty()) assertFalse(simpleMatch.isEmpty())
...@@ -166,7 +171,8 @@ class ExpressionMatchTest { ...@@ -166,7 +171,8 @@ class ExpressionMatchTest {
val complexMatch = val complexMatch =
ExpressionMatch( ExpressionMatch(
"""never?gonna*give\*you\?up\\test|y\yeah\\1\\\\2\\\1inval""", """never?gonna*give\*you\?up\\test|y\yeah\\1\\\\2\\\1inval""",
ExpressionMatch.MatchMode.MatchWildcard, false ExpressionMatch.MatchMode.MatchWildcard,
false,
) )
// Assert valid and not empty // Assert valid and not empty
...@@ -219,62 +225,73 @@ class ExpressionMatchTest { ...@@ -219,62 +225,73 @@ class ExpressionMatchTest {
val emptyMatch = val emptyMatch =
ExpressionMatch( ExpressionMatch(
";!\n;", ";!\n;",
ExpressionMatch.MatchMode.MatchMultiWildcard, false ExpressionMatch.MatchMode.MatchMultiWildcard,
false,
) )
val simpleMatch = val simpleMatch =
ExpressionMatch( ExpressionMatch(
"?test*;another?", "?test*;another?",
ExpressionMatch.MatchMode.MatchMultiWildcard, false ExpressionMatch.MatchMode.MatchMultiWildcard,
false,
) )
val simpleMatchCS = val simpleMatchCS =
ExpressionMatch( ExpressionMatch(
"?test*;another?", "?test*;another?",
ExpressionMatch.MatchMode.MatchMultiWildcard, true ExpressionMatch.MatchMode.MatchMultiWildcard,
true,
) )
val simpleMatchEscape = val simpleMatchEscape =
ExpressionMatch( ExpressionMatch(
"\\?test\\*\\\n*thing\\*", "\\?test\\*\\\n*thing\\*",
ExpressionMatch.MatchMode.MatchMultiWildcard, false ExpressionMatch.MatchMode.MatchMultiWildcard,
false,
) )
val simpleMatchInvert = val simpleMatchInvert =
ExpressionMatch( ExpressionMatch(
"""test*;!testing;\!testing""", """test*;!testing;\!testing""",
ExpressionMatch.MatchMode.MatchMultiWildcard, false ExpressionMatch.MatchMode.MatchMultiWildcard,
false,
) )
val simpleMatchImplicit = val simpleMatchImplicit =
ExpressionMatch( ExpressionMatch(
"""!testing*""", """!testing*""",
ExpressionMatch.MatchMode.MatchMultiWildcard, false ExpressionMatch.MatchMode.MatchMultiWildcard,
false,
) )
val complexMatchFull = """norm;!invert; norm-space ; !invert-space ;;!;\!norm-escaped;""" + val complexMatchFull =
"""\\!slash-invert;\\\\double; escape\;sep;slash-end-split\\;""" + """norm;!invert; norm-space ; !invert-space ;;!;\!norm-escaped;""" +
"""quad\\\\!noninvert;newline-split""" + "\n" + """\\!slash-invert;\\\\double; escape\;sep;slash-end-split\\;""" +
"""newline-split-slash\\""" + "\n" + """quad\\\\!noninvert;newline-split""" + "\n" +
"""slash-at-end\\""" """newline-split-slash\\""" + "\n" +
"""slash-at-end\\"""
// Match normal components // Match normal components
val complexMatchNormal = listOf( val complexMatchNormal =
"""norm""", listOf(
"""norm-space""", """norm""",
"""!norm-escaped""", """norm-space""",
"""\!slash-invert""", """!norm-escaped""",
"""\\double""", """\!slash-invert""",
"""escape;sep""", """\\double""",
"""slash-end-split\""", """escape;sep""",
"""quad\\!noninvert""", """slash-end-split\""",
"""newline-split""", """quad\\!noninvert""",
"""newline-split-slash\""", """newline-split""",
"""slash-at-end\""" """newline-split-slash\""",
) """slash-at-end\""",
)
// Match negating components // Match negating components
val complexMatchInvert = listOf( val complexMatchInvert =
"""invert""", listOf(
"""invert-space""" """invert""",
) """invert-space""",
val complexMatch = ExpressionMatch( )
complexMatchFull, ExpressionMatch.MatchMode.MatchMultiWildcard, val complexMatch =
false ExpressionMatch(
) complexMatchFull,
ExpressionMatch.MatchMode.MatchMultiWildcard,
false,
)
// Assert valid and not empty // Assert valid and not empty
assertTrue(emptyMatch.isEmpty()) assertTrue(emptyMatch.isEmpty())
...@@ -336,37 +353,43 @@ class ExpressionMatchTest { ...@@ -336,37 +353,43 @@ class ExpressionMatchTest {
val emptyMatch = val emptyMatch =
ExpressionMatch( ExpressionMatch(
""" """, """ """,
ExpressionMatch.MatchMode.MatchRegEx, false ExpressionMatch.MatchMode.MatchRegEx,
false,
) )
// Simple regex, case-insensitive // Simple regex, case-insensitive
val simpleMatch = val simpleMatch =
ExpressionMatch( ExpressionMatch(
"""simple.\*escape-match.*""", """simple.\*escape-match.*""",
ExpressionMatch.MatchMode.MatchRegEx, false ExpressionMatch.MatchMode.MatchRegEx,
false,
) )
// Simple regex, case-sensitive // Simple regex, case-sensitive
val simpleMatchCS = val simpleMatchCS =
ExpressionMatch( ExpressionMatch(
"""simple.\*escape-match.*""", """simple.\*escape-match.*""",
ExpressionMatch.MatchMode.MatchRegEx, true ExpressionMatch.MatchMode.MatchRegEx,
true,
) )
// Inverted regex, case-insensitive // Inverted regex, case-insensitive
val simpleMatchInvert = val simpleMatchInvert =
ExpressionMatch( ExpressionMatch(
"""!invert.\*escape-match.*""", """!invert.\*escape-match.*""",
ExpressionMatch.MatchMode.MatchRegEx, false ExpressionMatch.MatchMode.MatchRegEx,
false,
) )
// Non-inverted regex, case-insensitive // Non-inverted regex, case-insensitive
val simpleMatchNoInvert = val simpleMatchNoInvert =
ExpressionMatch( ExpressionMatch(
"""\!simple.\*escape-match.*""", """\!simple.\*escape-match.*""",
ExpressionMatch.MatchMode.MatchRegEx, false ExpressionMatch.MatchMode.MatchRegEx,
false,
) )
// Non-inverted regex literal slash, case-insensitive // Non-inverted regex literal slash, case-insensitive
val simpleMatchNoInvertSlash = val simpleMatchNoInvertSlash =
ExpressionMatch( ExpressionMatch(
"""\\!simple.\*escape-match.*""", """\\!simple.\*escape-match.*""",
ExpressionMatch.MatchMode.MatchRegEx, false ExpressionMatch.MatchMode.MatchRegEx,
false,
) )
// Assert valid and not empty // Assert valid and not empty
...@@ -416,32 +439,35 @@ class ExpressionMatchTest { ...@@ -416,32 +439,35 @@ class ExpressionMatchTest {
// Tests imported from https://github.com/ircdocs/parser-tests/blob/master/tests/mask-match.yaml // Tests imported from https://github.com/ircdocs/parser-tests/blob/master/tests/mask-match.yaml
@Test @Test
fun testDan() { fun testDan() {
val mask1 = ExpressionMatch( val mask1 =
"*@127.0.0.1", ExpressionMatch(
ExpressionMatch.MatchMode.MatchWildcard, "*@127.0.0.1",
caseSensitive = false ExpressionMatch.MatchMode.MatchWildcard,
) caseSensitive = false,
)
assertTrue(mask1.match("coolguy!ab@127.0.0.1")) assertTrue(mask1.match("coolguy!ab@127.0.0.1"))
assertTrue(mask1.match("cooldud3!~bc@127.0.0.1")) assertTrue(mask1.match("cooldud3!~bc@127.0.0.1"))
assertFalse(mask1.match("coolguy!ab@127.0.0.5")) assertFalse(mask1.match("coolguy!ab@127.0.0.5"))
assertFalse(mask1.match("cooldud3!~d@124.0.0.1")) assertFalse(mask1.match("cooldud3!~d@124.0.0.1"))
val mask2 = ExpressionMatch( val mask2 =
"cool*@*", ExpressionMatch(
ExpressionMatch.MatchMode.MatchWildcard, "cool*@*",
caseSensitive = false ExpressionMatch.MatchMode.MatchWildcard,
) caseSensitive = false,
)
assertTrue(mask2.match("coolguy!ab@127.0.0.1")) assertTrue(mask2.match("coolguy!ab@127.0.0.1"))
assertTrue(mask2.match("cooldud3!~bc@127.0.0.1")) assertTrue(mask2.match("cooldud3!~bc@127.0.0.1"))
assertTrue(mask2.match("cool132!ab@example.com")) assertTrue(mask2.match("cool132!ab@example.com"))
assertFalse(mask2.match("koolguy!ab@127.0.0.5")) assertFalse(mask2.match("koolguy!ab@127.0.0.5"))
assertFalse(mask2.match("cooodud3!~d@124.0.0.1")) assertFalse(mask2.match("cooodud3!~d@124.0.0.1"))
val mask3 = ExpressionMatch( val mask3 =
"cool!*@*", ExpressionMatch(
ExpressionMatch.MatchMode.MatchWildcard, "cool!*@*",
caseSensitive = false ExpressionMatch.MatchMode.MatchWildcard,
) caseSensitive = false,
)
assertTrue(mask3.match("cool!guyab@127.0.0.1")) assertTrue(mask3.match("cool!guyab@127.0.0.1"))
assertTrue(mask3.match("cool!~dudebc@127.0.0.1")) assertTrue(mask3.match("cool!~dudebc@127.0.0.1"))
assertTrue(mask3.match("cool!312ab@example.com")) assertTrue(mask3.match("cool!312ab@example.com"))
...@@ -451,11 +477,12 @@ class ExpressionMatchTest { ...@@ -451,11 +477,12 @@ class ExpressionMatchTest {
assertFalse(mask3.match("cooodud3!~d@124.0.0.1")) assertFalse(mask3.match("cooodud3!~d@124.0.0.1"))
// Cause failures in fnmatch/glob based matchers // Cause failures in fnmatch/glob based matchers
val mask4 = ExpressionMatch( val mask4 =
"cool[guy]!*@*", ExpressionMatch(
ExpressionMatch.MatchMode.MatchWildcard, "cool[guy]!*@*",
caseSensitive = false ExpressionMatch.MatchMode.MatchWildcard,
) caseSensitive = false,
)
assertTrue(mask4.match("cool[guy]!guy@127.0.0.1")) assertTrue(mask4.match("cool[guy]!guy@127.0.0.1"))
assertTrue(mask4.match("cool[guy]!a@example.com")) assertTrue(mask4.match("cool[guy]!a@example.com"))
assertFalse(mask4.match("coolg!ab@127.0.0.1")) assertFalse(mask4.match("coolg!ab@127.0.0.1"))
......
...@@ -23,22 +23,22 @@ class QVariantTest { ...@@ -23,22 +23,22 @@ class QVariantTest {
"QVariant(QByteArray, DEADBEEF)", "QVariant(QByteArray, DEADBEEF)",
qVariant( qVariant(
byteBufferOf(0xDEu, 0xADu, 0xBEu, 0xEFu), byteBufferOf(0xDEu, 0xADu, 0xBEu, 0xEFu),
QtType.QByteArray QtType.QByteArray,
).toString() ).toString(),
) )
assertEquals( assertEquals(
"QVariant(QString, DEADBEEF)", "QVariant(QString, DEADBEEF)",
qVariant( qVariant(
"DEADBEEF", "DEADBEEF",
QtType.QString QtType.QString,
).toString() ).toString(),
) )
assertEquals( assertEquals(
"QVariant(BufferId, BufferId(-1))", "QVariant(BufferId, BufferId(-1))",
qVariant( qVariant(
BufferId(-1), BufferId(-1),
QuasselType.BufferId QuasselType.BufferId,
).toString() ).toString(),
) )
} }
} }
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
* obtain one at https://mozilla.org/MPL/2.0/. * obtain one at https://mozilla.org/MPL/2.0/.
*/ */
enableFeaturePreview("VERSION_CATALOGS")
rootProject.name = "libquassel" rootProject.name = "libquassel"
includeBuild("gradle/convention") includeBuild("gradle/convention")
include( include(
":libquassel-annotations", ":libquassel-annotations",
":libquassel-api",
":libquassel-client", ":libquassel-client",
":libquassel-persistence",
":libquassel-generator", ":libquassel-generator",
":libquassel-irc", ":libquassel-irc",
":libquassel-protocol" ":libquassel-protocol"
......