Skip to content

Commit

Permalink
rename to utf8z.GetZeroTerminatedUTF8Bytes() and add a simple test ca…
Browse files Browse the repository at this point in the history
…se for it. #399
  • Loading branch information
ericsink committed Feb 9, 2021
1 parent 3c6f89d commit fcddb4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<Copyright>Copyright 2014-2021 SourceGear, LLC</Copyright>
<Company>SourceGear</Company>
<Authors>Eric Sink</Authors>
<Version>2.0.5-pre20210120090000</Version>
<AssemblyVersion>2.0.5.1115</AssemblyVersion>
<FileVersion>2.0.5.1115</FileVersion>
<Version>2.0.5-pre20210209124043</Version>
<AssemblyVersion>2.0.5.1135</AssemblyVersion>
<FileVersion>2.0.5.1135</FileVersion>
<Description>SQLitePCLRaw is a Portable Class Library (PCL) for low-level (raw) access to SQLite</Description>
<ProviderLangVersion>7.3</ProviderLangVersion>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
Expand Down
2 changes: 1 addition & 1 deletion src/SQLitePCLRaw.core/utf8z.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public string utf8_to_string()
/// int)"/>. Note that for <see cref="FromPtrLen(byte*, int)"/> the length provided should not include the
/// trailing <c>\0</c> terminator.
/// </summary>
public static byte[] GetNullTerminatedUTF8Bytes(string value)
public static byte[] GetZeroTerminatedUTF8Bytes(string value)
{
return util.to_utf8_with_z(value);
}
Expand Down
9 changes: 9 additions & 0 deletions src/common/tests_xunit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ public static byte[] to_utf8(string s)
[Collection("Init")]
public class test_cases
{
[Fact]
public void test_GetZeroTerminatedUTF8Bytes()
{
const string s = "hello";
var ba = utf8z.GetZeroTerminatedUTF8Bytes("hello");
Assert.Equal(s.Length + 1, ba.Length);
Assert.Equal(0, ba[s.Length]);
}

[Fact]
public void test_call_sqlite3_enable_load_extension()
{
Expand Down

0 comments on commit fcddb4b

Please sign in to comment.