about summary refs log tree commit diff stats
path: root/subx/examples/ex5.subx
Commit message (Expand)AuthorAgeFilesLines
* switch to new syntax for segment headers in C++Kartik Agaram2019-05-181-1/+1
* 4981 - no, go back to 3 phasesKartik Agaram2019-02-181-1/+2
* 4893Kartik Agaram2018-12-301-2/+2
* 4808 - clean up comments in all subx filesKartik Agaram2018-11-301-9/+9
* 4802Kartik Agaram2018-11-301-4/+4
* 4801Kartik Agaram2018-11-301-20/+20
* 4698Kartik Agaram2018-10-141-5/+5
* 4668Kartik Agaram2018-10-051-7/+7
* 4662Kartik Agaram2018-10-051-1/+1
* 4644Kartik Agaram2018-10-011-8/+8
* 4639Kartik Agaram2018-10-011-3/+3
* 4624Kartik Agaram2018-09-301-1/+1
* 4503Kartik Agaram2018-09-221-5/+2
* 4591Kartik Agaram2018-09-221-1/+1
* 4589Kartik Agaram2018-09-221-12/+12
* 4581Kartik Agaram2018-09-211-3/+3
* 4562Kartik Agaram2018-09-201-3/+3
* 4561Kartik Agaram2018-09-201-12/+12
* 4531 - automatically compute segment addressesKartik Agaram2018-09-011-1/+1
* 4529 - move examples to a sub-directoryKartik Agaram2018-09-011-0/+45
Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
package main

import (
	"errors"
	"net/http"
	"net/http/httptest"
	"testing"
)

func Test_log400(t *testing.T) {
	initTestConf()
	t.Run("log400", func(t *testing.T) {
		w := httptest.NewRecorder()
		req := httptest.NewRequest("POST", "/400", nil)
		log400(w, req, "400 Test")
		resp := w.Result()
		if resp.StatusCode != http.StatusBadRequest {
			t.Errorf("Didn't receive 400, received: %v\n", resp.StatusCode)
		}
	})
}

func Test_log404(t *testing.T) {
	initTestConf()
	t.Run("log404", func(t *testing.T) {
		w := httptest.NewRecorder()
		req := httptest.NewRequest("GET", "/404", nil)
		log404(w, req, errors.New("404 Test"))
		resp := w.Result()
		if resp.StatusCode != http.StatusNotFound {
			t.Errorf("Didn't receive 404, received: %v\n", resp.StatusCode)
		}
	})
}

func Test_log500(t *testing.T) {
	initTestConf()
	t.Run("log500", func(t *testing.T) {
		w := httptest.NewRecorder()
		req := httptest.NewRequest("POST", "/500", nil)
		log500(w, req, errors.New("500 Test"))
		resp := w.Result()
		if resp.StatusCode != http.StatusInternalServerError {
			t.Errorf("Didn't receive 500, received: %v\n", resp.StatusCode)
		}
	})
}