Skip to content
Myr

util_test.go

This file

Path

src/util/util_test.go

40 lines · 570 bytes · Go

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than af1a5f1 point at it.

Add clear-query and clear-selectionJunegunn Choibefore adoptionaf1a5f1

lines 1–22why, one step back
1package util
23import "testing"45func TestMax(t *testing.T) {6 if Max(-2, 5) != 5 {7 t.Error("Invalid result")8 }9}1011func TestContrain(t *testing.T) {12 if Constrain(-3, -1, 3) != -1 {13 t.Error("Expected", -1)14 }15 if Constrain(2, -1, 3) != 2 {16 t.Error("Expected", 2)17 }1819 if Constrain(5, -1, 3) != 3 {20 t.Error("Expected", 3)21 }22}

Defer resetting multi-selection on reloadJunegunn Choibefore adoption2b725a4

lines 23–40why, one step back
23
24func TestOnce(t *testing.T) {25 o := Once(false)26 if o() {27 t.Error("Expected: false")28 }29 if o() {30 t.Error("Expected: false")31 }3233 o = Once(true)34 if !o() {35 t.Error("Expected: true")36 }37 if o() {38 t.Error("Expected: false")39 }40}