Skip to content

Instantly share code, notes, and snippets.

@mottet-dev
mottet-dev / client-side.html
Last active September 18, 2023 20:05
Example of HTML structure for client-side rendered pages
<html>
<head>
<script src="https://fakescripturl.com/index.js" type="text/javascript"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
{
name: "Compare slices with different number of elements",
args: args{
a: []int{1, 2, 3, 4},
b: []int{2, 4, 1},
},
want: false,
},
{
name: "Compare slices with same number of elements but different elements",
args: args{
a: []int{1, 2, 3, 4},
b: []int{5, 2, 4, 1},
},
want: false,
},
@mottet-dev
mottet-dev / slices_test.go
Created July 10, 2019 20:50
Go Test - TestAreSlicesEqual
func TestAreSlicesEqual(t *testing.T) {
type args struct {
a []int
b []int
}
tests := []struct {
name string
args args
want bool
}{
@mottet-dev
mottet-dev / slices_test.go
Created July 10, 2019 20:45
Go Test - TestAreSlicesEqual
func TestAreSlicesEqual(t *testing.T) {
type args struct {
a []int
b []int
}
tests := []struct {
name string
args args
want bool
}{
@mottet-dev
mottet-dev / slices.go
Created July 10, 2019 20:32
Go test - AreSlicesEqual
func AreSlicesEqual(a, b []int) bool {
if len(a) != len(b) {
return false
}
for _, i := range a {
if !DoesSliceIncludesInt(i, b) {
return false
}
}
@mottet-dev
mottet-dev / slices_test.go
Created July 8, 2019 20:54
Go test - Not In Slice
func TestDoesSliceIncludesIntNotInSlice(t *testing.T) {
inputValue := 4
inputSlice := []int{1, 2, 3}
expectedOutput := false
got := DoesSliceIncludesInt(inputValue, inputSlice)
if got != expectedOutput {
t.Errorf("SliceIncludesInt(%d, %d) = %t; want %t", inputValue, inputSlice, got, expectedOutput)
package helpers
import "testing"
func TestDoesSliceIncludesInt(t *testing.T) {
inputValue := 3
inputSlice := []int{1, 2, 3}
expectedOutput := true
package helpers
import "testing"
func TestDoesSliceIncludesInt(t *testing.T) {
inputValue := 3
inputSlice := []int{1, 2, 3}
expectedOutput := true
@mottet-dev
mottet-dev / slices_test.go
Created July 8, 2019 20:25
Go Test - TestDoesSliceIncludesInt
package helpers
import "testing"
func TestDoesSliceIncludesInt(t *testing.T) {
// Content of the test
}