-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: accept Symbol type driver id parameter in open()
- Loading branch information
Showing
3 changed files
with
68 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
xk6-sql `v1.0.3` is here 🎉! | ||
|
||
This release includes: | ||
|
||
Bugfixes: | ||
|
||
- [Symbol type driver parameter support](https://github.com/grafana/xk6-sql/issues/120): The `open()` function now accepts `Symbol` (class) type driver ids in addition to the primitive symbol type. This is because when a driver is imported with the `require()` function, it is not a primitive symbol that is imported, but a `Symbol` class type. Also fixes [#115](https://github.com/grafana/xk6-sql/issues/115) |
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,33 @@ | ||
package sql | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/grafana/sobek" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_asSymbol(t *testing.T) { | ||
t.Parallel() | ||
|
||
symbol := sobek.NewSymbol("foo") | ||
|
||
sym, ok := asSymbol(symbol) | ||
|
||
require.True(t, ok) | ||
require.Same(t, symbol, sym) | ||
|
||
rt := sobek.New() | ||
|
||
obj := symbol.ToObject(rt) | ||
|
||
sym, ok = asSymbol(obj) | ||
|
||
require.True(t, ok) | ||
require.Same(t, symbol, sym) | ||
|
||
sym, ok = asSymbol(sobek.Undefined()) | ||
|
||
require.False(t, ok) | ||
require.Nil(t, sym) | ||
} |