This repository has been archived by the owner on Apr 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix up a bunch of go duration bugs and add tests
- Loading branch information
1 parent
2486298
commit 4020d65
Showing
3 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Consul.Test | ||
{ | ||
public class UtilTest | ||
{ | ||
[Fact] | ||
public void GoDurationTest() | ||
{ | ||
Assert.Equal("150ms", new TimeSpan(0, 0, 0, 0, 150).ToGoDuration()); | ||
Assert.Equal("26h3m4.005s", new TimeSpan(1, 2, 3, 4, 5).ToGoDuration()); | ||
Assert.Equal("2h3m4.005s", new TimeSpan(0, 2, 3, 4, 5).ToGoDuration()); | ||
Assert.Equal("3m4.005s", new TimeSpan(0, 0, 3, 4, 5).ToGoDuration()); | ||
Assert.Equal("4.005s", new TimeSpan(0, 0, 0, 4, 5).ToGoDuration()); | ||
Assert.Equal("5ms", new TimeSpan(0, 0, 0, 0, 5).ToGoDuration()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters