From 8561f4278693badb8ac312665c5e566ef8ef5f6b Mon Sep 17 00:00:00 2001 From: elcore Date: Tue, 4 Oct 2016 01:15:23 +0200 Subject: [PATCH] CurvePreferences (Test) (#1161) We need consistency in code style!!! --- caddytls/setup_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/caddytls/setup_test.go b/caddytls/setup_test.go index 8811b2c6..b630e741 100644 --- a/caddytls/setup_test.go +++ b/caddytls/setup_test.go @@ -298,10 +298,12 @@ func TestSetupParseWithCurves(t *testing.T) { t.Errorf("Expected 3 curves, got %v", len(cfg.CurvePreferences)) } - expectedCurveOrder := []tls.CurveID{tls.CurveP256, tls.CurveP384, tls.CurveP521} - for i := range cfg.CurvePreferences { - if cfg.CurvePreferences[i] != expectedCurveOrder[i] { - t.Errorf("Expected %v as curve, got %v", expectedCurveOrder[i], cfg.CurvePreferences[i]) + expectedCurves := []tls.CurveID{tls.CurveP256, tls.CurveP384, tls.CurveP521} + + // Ensure ordering is correct + for i, actual := range cfg.CurvePreferences { + if actual != expectedCurves[i] { + t.Errorf("Expected curve in position %d to be %v, got %v", i, expectedCurves[i], actual) } } }