gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: allowing space(s) between number and d


From: gnunet
Subject: [libeufin] branch master updated: allowing space(s) between number and duration unit
Date: Thu, 02 Nov 2023 09:14:26 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 0395d893 allowing space(s) between number and duration unit
0395d893 is described below

commit 0395d8932a3fce80d0cbe3c91cf8d0b004f07251
Author: MS <ms@taler.net>
AuthorDate: Thu Nov 2 09:14:00 2023 +0100

    allowing space(s) between number and duration unit
---
 nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt | 2 +-
 nexus/src/test/kotlin/ConfigLoading.kt                   | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt
index 896e4cb1..5fe65320 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt
@@ -99,7 +99,7 @@ fun getFrequencyInSeconds(humanFormat: String): Int? {
     }
     val maybeNumber = trimmed.dropLast(1)
     val howMany = try {
-        maybeNumber.toInt()
+        maybeNumber.trimEnd().toInt()
     } catch (e: Exception) {
         logger.error("Prefix was not a valid input: '$maybeNumber'")
         return null
diff --git a/nexus/src/test/kotlin/ConfigLoading.kt 
b/nexus/src/test/kotlin/ConfigLoading.kt
index e281399a..12ab6734 100644
--- a/nexus/src/test/kotlin/ConfigLoading.kt
+++ b/nexus/src/test/kotlin/ConfigLoading.kt
@@ -49,8 +49,11 @@ class ConfigLoading {
     @Test
     fun timeParsing() {
         assertEquals(1, getFrequencyInSeconds("1s"))
+        assertEquals(1, getFrequencyInSeconds("       1           s       "))
         assertEquals(10*60, getFrequencyInSeconds("10m"))
+        assertEquals(10*60, getFrequencyInSeconds("10 m"))
         assertEquals(24*60*60, getFrequencyInSeconds("24h"))
+        assertEquals(24*60*60, getFrequencyInSeconds(" 24h"))
         assertEquals(60*60, getFrequencyInSeconds("      1h      "))
         assertEquals(60*60, getFrequencyInSeconds("01h"))
         assertNull(getFrequencyInSeconds("1.1s"))

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]