core

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCompile = errors.New("compilation error")
	ErrExecute = errors.New("execution error")
)
View Source
var Engines = map[string]Engine{
	".c": {
		Mode:    "compile",
		Command: []string{"cc", "{file}", "-o", "{temp}", "-std=c17"},
	},
	".cpp": {
		Mode:    "compile",
		Command: []string{"c++", "{file}", "-o", "{temp}", "-std=c++17"},
	},
	".go": {
		Mode:    "compile",
		Command: []string{"go", "build", "-o", "{temp}", "{file}"},
	},
	".py": {
		Mode:    "interpret",
		Command: []string{"python3", "{file}"},
	},
	".rs": {
		Mode:    "compile",
		Command: []string{"rustc", "{file}", "-o", "{temp}"},
	},
	".zig": {
		Mode:    "compile",
		Command: []string{"zig", "build-exe", "{file}", "-femit-bin={temp}"},
	},
}

default engines

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// mode can be 'compile' or 'interpret'
	Mode    string   `json:"mode"`
	Command []string `json:"command"`
}

func (*Engine) Run

func (e *Engine) Run(path, input string) (string, error)
type NavigateMsg struct {
	Path string
}

NavigateMsg is sent to navigate to a new path. If Path is empty, the app reverts to the active model derived from the current state, simulating popup dismissal. If Path is non-empty, the app state updates and the active model is derived from the new path (dir → filepicker, file → workspace).

type TestCase

type TestCase struct {
	Status  TestCaseStatus `json:"status"`
	Details string         `json:"details"`

	// Input is the data fed to the program's stdin.
	Input string `json:"input"`

	// Expected is the stdout the program should produce.
	Expected string `json:"expected"`

	// Output is the actual stdout (and stderr) captured during the last run.
	Output string `json:"output"`
}

func NewTestCase

func NewTestCase() *TestCase

NewTestCase returns a TestCase in its initial idle state.

func (*TestCase) Execute

func (tc *TestCase) Execute(srcPath string)

run performs the synchronous execution and updates tc with the verdict.

func (*TestCase) ExecuteCmd

func (tc *TestCase) ExecuteCmd(srcPath string) tea.Cmd

type TestCaseExecutedMsg

type TestCaseExecutedMsg struct {
	TestCase *TestCase
}

TestCaseExecutedMsg is dispatched when a TestCase has finished running.

type TestCaseList

type TestCaseList []*TestCase

TestCaseList is an ordered collection of test cases for a single source file.

func LoadTestCaseList

func LoadTestCaseList(filePath string) TestCaseList

func (*TestCaseList) Append

func (list *TestCaseList) Append()

Append adds a fresh, idle test case to the end of the list.

func (*TestCaseList) RemoveAt

func (list *TestCaseList) RemoveAt(index int)

RemoveAt removes the test case at index. It is a no-op if index is out of range.

func (TestCaseList) Save

func (list TestCaseList) Save(sourceFile string) error

func (TestCaseList) SaveCmd

func (list TestCaseList) SaveCmd(filePath string) tea.Cmd

type TestCaseStatus

type TestCaseStatus string

TestCaseStatus is the verdict of the most recent run of a TestCase.

const (
	TestCaseStatusPending TestCaseStatus = "Pending"
	TestCaseStatusCorrect TestCaseStatus = "Correct"
	TestCaseStatusWrong   TestCaseStatus = "Wrong"
	TestCaseStatusError   TestCaseStatus = "Error"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL