From 2904961a2cb2b59928a98d5f349788cfcc75628e Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Wed, 13 Jan 2021 14:05:50 +0200 Subject: [PATCH] Add/move SharedArray tests to it's module (#1795) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ivan Mirić --- js/modules/k6/data/share_test.go | 189 +++++++++++++++++++++++++++++++ js/share_test.go | 76 +------------ 2 files changed, 190 insertions(+), 75 deletions(-) create mode 100644 js/modules/k6/data/share_test.go diff --git a/js/modules/k6/data/share_test.go b/js/modules/k6/data/share_test.go new file mode 100644 index 00000000000..dce89b79aa8 --- /dev/null +++ b/js/modules/k6/data/share_test.go @@ -0,0 +1,189 @@ +/* + * + * k6 - a next-generation load testing tool + * Copyright (C) 2020 Load Impact + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +package data + +import ( + "context" + "testing" + + "github.com/dop251/goja" + "github.com/loadimpact/k6/js/common" + "github.com/stretchr/testify/require" +) + +const makeArrayScript = ` +var array = new data.SharedArray("shared",function() { + var n = 50; + var arr = new Array(n); + for (var i = 0 ; i