feat: aplicação inicial — gerenciador de notas web estilo Mousepad

- Backend Go: API REST, auth por token (Bearer + cookie HttpOnly), storage em disco
  com revisões content-addressed (estilo Git: hash, autor, data, diff, restauração)
- Editor txt/md/html com preview, tags #tag, categorias, painel de histórico
- Preferências: números de linha, marcador de coluna (padrão 80), quebra de linha,
  fonte/tamanho, 4 temas e colorização de sintaxe (overlay no textarea)
- Frontend vanilla embutido via go:embed; Dockerfile multi-stage + docker-compose
This commit is contained in:
lgcosta committed 2026-11-04 09:41:46 -03:00
commit 9bc5de4c56
22 files changed
+4239

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
package diffx
import (
"strings"
"testing"
)
func TestUnifiedEmptyWhenEqual(t *testing.T) {
if got := Unified("a.txt", "a.txt", "mesmo", "mesmo"); got != "" {
t.Fatalf("esperava diff vazio, veio %q", got)
}
}
func TestUnifiedCreateLooksLikeGit(t *testing.T) {
got := Unified("(sem conteúdo)", "nota.md", "", "# Ola\n\nlinha\n")
for _, want := range []string{"--- (sem conteúdo)", "+++ nota.md", "@@", "+# Ola", "+linha"} {
if !strings.Contains(got, want) {
t.Errorf("diff deveria conter %q; diff:\n%s", want, got)
}
}
if strings.Contains(got, "-linha") {
t.Errorf("não deveria haver remoção em criação pura:\n%s", got)
}
}
func TestUnifiedEditHasAddAndRemove(t *testing.T) {
before := "alpha\nbravo\ncharlie\n"
after := "alpha\nBRAVO change\ncharlie\ndelta\n"
got := Unified("n", "n", before, after)
added, removed := Stats(got)
if removed != 1 {
t.Errorf("esperava 1 remoção, obtive %d (diff:\n%s)", removed, got)
}
if added != 2 {
t.Errorf("esperava 2 adições, obtive %d (diff:\n%s)", added, got)
}
}
func TestStatsIgnoresFileHeaders(t *testing.T) {
added, removed := Stats("--- a\n+++ b\n@@ -1 +1 @@\n+x\n")
if added != 1 || removed != 0 {
t.Fatalf("added=%d removed=%d, esperava 1/0", added, removed)
}
}