fix(ci): formatting;
This commit is contained in:
parent
28182e1a5f
commit
a5cf5cb5d2
10 changed files with 226 additions and 226 deletions
|
|
@ -1,55 +1,55 @@
|
||||||
-- Unit tests for caching system
|
-- Unit tests for caching system
|
||||||
describe("cp.cache", function()
|
describe('cp.cache', function()
|
||||||
local cache
|
local cache
|
||||||
local temp_dir
|
local temp_dir
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
cache = require("cp.cache")
|
cache = require('cp.cache')
|
||||||
temp_dir = vim.fn.tempname()
|
temp_dir = vim.fn.tempname()
|
||||||
vim.fn.mkdir(temp_dir, "p")
|
vim.fn.mkdir(temp_dir, 'p')
|
||||||
-- Mock cache directory
|
-- Mock cache directory
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
-- Clean up temp files
|
-- Clean up temp files
|
||||||
vim.fn.delete(temp_dir, "rf")
|
vim.fn.delete(temp_dir, 'rf')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("contest metadata caching", function()
|
describe('contest metadata caching', function()
|
||||||
it("stores contest metadata correctly", function()
|
it('stores contest metadata correctly', function()
|
||||||
-- Test storing contest data
|
-- Test storing contest data
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("retrieves cached contest metadata", function()
|
it('retrieves cached contest metadata', function()
|
||||||
-- Test retrieving contest data
|
-- Test retrieving contest data
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles missing cache files gracefully", function()
|
it('handles missing cache files gracefully', function()
|
||||||
-- Test missing cache behavior
|
-- Test missing cache behavior
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("test case caching", function()
|
describe('test case caching', function()
|
||||||
it("stores test cases for problems", function()
|
it('stores test cases for problems', function()
|
||||||
-- Test test case storage
|
-- Test test case storage
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("retrieves cached test cases", function()
|
it('retrieves cached test cases', function()
|
||||||
-- Test test case retrieval
|
-- Test test case retrieval
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles cache invalidation", function()
|
it('handles cache invalidation', function()
|
||||||
-- Test cache expiry/invalidation
|
-- Test cache expiry/invalidation
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("cache persistence", function()
|
describe('cache persistence', function()
|
||||||
it("persists cache across sessions", function()
|
it('persists cache across sessions', function()
|
||||||
-- Test cache file persistence
|
-- Test cache file persistence
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles corrupted cache files", function()
|
it('handles corrupted cache files', function()
|
||||||
-- Test corrupted cache recovery
|
-- Test corrupted cache recovery
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,79 +1,79 @@
|
||||||
-- Unit tests for command parsing and validation
|
-- Unit tests for command parsing and validation
|
||||||
describe("cp command parsing", function()
|
describe('cp command parsing', function()
|
||||||
local cp
|
local cp
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
cp = require("cp")
|
cp = require('cp')
|
||||||
cp.setup()
|
cp.setup()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("platform setup commands", function()
|
describe('platform setup commands', function()
|
||||||
it("parses :CP codeforces correctly", function()
|
it('parses :CP codeforces correctly', function()
|
||||||
-- Test platform-only command parsing
|
-- Test platform-only command parsing
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("parses :CP codeforces 1800 correctly", function()
|
it('parses :CP codeforces 1800 correctly', function()
|
||||||
-- Test contest setup command parsing
|
-- Test contest setup command parsing
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("parses :CP codeforces 1800 A correctly", function()
|
it('parses :CP codeforces 1800 A correctly', function()
|
||||||
-- Test full setup command parsing
|
-- Test full setup command parsing
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("parses CSES format :CP cses 1068 correctly", function()
|
it('parses CSES format :CP cses 1068 correctly', function()
|
||||||
-- Test CSES-specific command parsing
|
-- Test CSES-specific command parsing
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("action commands", function()
|
describe('action commands', function()
|
||||||
it("parses :CP test correctly", function()
|
it('parses :CP test correctly', function()
|
||||||
-- Test test panel command
|
-- Test test panel command
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("parses :CP next correctly", function()
|
it('parses :CP next correctly', function()
|
||||||
-- Test navigation command
|
-- Test navigation command
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("parses :CP prev correctly", function()
|
it('parses :CP prev correctly', function()
|
||||||
-- Test navigation command
|
-- Test navigation command
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("language flags", function()
|
describe('language flags', function()
|
||||||
it("parses --lang=cpp correctly", function()
|
it('parses --lang=cpp correctly', function()
|
||||||
-- Test language flag parsing
|
-- Test language flag parsing
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("parses --debug flag correctly", function()
|
it('parses --debug flag correctly', function()
|
||||||
-- Test debug flag parsing
|
-- Test debug flag parsing
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("combines flags correctly", function()
|
it('combines flags correctly', function()
|
||||||
-- Test multiple flag parsing
|
-- Test multiple flag parsing
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("error handling", function()
|
describe('error handling', function()
|
||||||
it("handles invalid commands gracefully", function()
|
it('handles invalid commands gracefully', function()
|
||||||
-- Test error messages for bad commands
|
-- Test error messages for bad commands
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("provides helpful error messages", function()
|
it('provides helpful error messages', function()
|
||||||
-- Test error message quality
|
-- Test error message quality
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("command completion", function()
|
describe('command completion', function()
|
||||||
it("completes platform names", function()
|
it('completes platform names', function()
|
||||||
-- Test tab completion for platforms
|
-- Test tab completion for platforms
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("completes problem IDs from cached contest", function()
|
it('completes problem IDs from cached contest', function()
|
||||||
-- Test problem ID completion
|
-- Test problem ID completion
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("completes action names", function()
|
it('completes action names', function()
|
||||||
-- Test action completion
|
-- Test action completion
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,46 @@
|
||||||
-- Unit tests for configuration management
|
-- Unit tests for configuration management
|
||||||
describe("cp.config", function()
|
describe('cp.config', function()
|
||||||
local config
|
local config
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
config = require("cp.config")
|
config = require('cp.config')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("setup", function()
|
describe('setup', function()
|
||||||
it("returns default config when no user config provided", function()
|
it('returns default config when no user config provided', function()
|
||||||
-- Test default configuration values
|
-- Test default configuration values
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("merges user config with defaults", function()
|
it('merges user config with defaults', function()
|
||||||
-- Test config merging behavior
|
-- Test config merging behavior
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("validates contest configurations", function()
|
it('validates contest configurations', function()
|
||||||
-- Test contest config validation
|
-- Test contest config validation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles invalid config gracefully", function()
|
it('handles invalid config gracefully', function()
|
||||||
-- Test error handling for bad configs
|
-- Test error handling for bad configs
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("platform validation", function()
|
describe('platform validation', function()
|
||||||
it("accepts valid platforms", function()
|
it('accepts valid platforms', function()
|
||||||
-- Test platform validation
|
-- Test platform validation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("rejects invalid platforms", function()
|
it('rejects invalid platforms', function()
|
||||||
-- Test platform rejection
|
-- Test platform rejection
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("language configurations", function()
|
describe('language configurations', function()
|
||||||
it("provides correct file extensions for languages", function()
|
it('provides correct file extensions for languages', function()
|
||||||
-- Test language -> extension mappings
|
-- Test language -> extension mappings
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("provides correct compile commands", function()
|
it('provides correct compile commands', function()
|
||||||
-- Test compile command generation
|
-- Test compile command generation
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,108 +1,108 @@
|
||||||
-- Unit tests for code compilation and execution
|
-- Unit tests for code compilation and execution
|
||||||
describe("cp.execute", function()
|
describe('cp.execute', function()
|
||||||
local execute
|
local execute
|
||||||
local temp_dir
|
local temp_dir
|
||||||
local test_files = {}
|
local test_files = {}
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
execute = require("cp.execute")
|
execute = require('cp.execute')
|
||||||
temp_dir = vim.fn.tempname()
|
temp_dir = vim.fn.tempname()
|
||||||
vim.fn.mkdir(temp_dir, "p")
|
vim.fn.mkdir(temp_dir, 'p')
|
||||||
vim.api.nvim_set_current_dir(temp_dir)
|
vim.api.nvim_set_current_dir(temp_dir)
|
||||||
|
|
||||||
-- Create sample source files for testing
|
-- Create sample source files for testing
|
||||||
test_files.cpp = temp_dir .. "/test.cpp"
|
test_files.cpp = temp_dir .. '/test.cpp'
|
||||||
test_files.python = temp_dir .. "/test.py"
|
test_files.python = temp_dir .. '/test.py'
|
||||||
test_files.rust = temp_dir .. "/test.rs"
|
test_files.rust = temp_dir .. '/test.rs'
|
||||||
|
|
||||||
-- Write simple test programs
|
-- Write simple test programs
|
||||||
vim.fn.writefile({
|
vim.fn.writefile({
|
||||||
'#include <iostream>',
|
'#include <iostream>',
|
||||||
'int main() { std::cout << "Hello" << std::endl; return 0; }'
|
'int main() { std::cout << "Hello" << std::endl; return 0; }',
|
||||||
}, test_files.cpp)
|
}, test_files.cpp)
|
||||||
|
|
||||||
vim.fn.writefile({
|
vim.fn.writefile({
|
||||||
'print("Hello")'
|
'print("Hello")',
|
||||||
}, test_files.python)
|
}, test_files.python)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
vim.fn.delete(temp_dir, "rf")
|
vim.fn.delete(temp_dir, 'rf')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("compilation", function()
|
describe('compilation', function()
|
||||||
it("compiles C++ code successfully", function()
|
it('compiles C++ code successfully', function()
|
||||||
-- Test C++ compilation
|
-- Test C++ compilation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("compiles Rust code successfully", function()
|
it('compiles Rust code successfully', function()
|
||||||
-- Test Rust compilation
|
-- Test Rust compilation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles compilation errors", function()
|
it('handles compilation errors', function()
|
||||||
-- Test error handling for bad code
|
-- Test error handling for bad code
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("applies optimization flags correctly", function()
|
it('applies optimization flags correctly', function()
|
||||||
-- Test optimization settings
|
-- Test optimization settings
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles debug flag correctly", function()
|
it('handles debug flag correctly', function()
|
||||||
-- Test debug compilation
|
-- Test debug compilation
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("execution", function()
|
describe('execution', function()
|
||||||
it("runs compiled programs", function()
|
it('runs compiled programs', function()
|
||||||
-- Test program execution
|
-- Test program execution
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles runtime errors", function()
|
it('handles runtime errors', function()
|
||||||
-- Test runtime error handling
|
-- Test runtime error handling
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("enforces time limits", function()
|
it('enforces time limits', function()
|
||||||
-- Test timeout handling
|
-- Test timeout handling
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("captures output correctly", function()
|
it('captures output correctly', function()
|
||||||
-- Test stdout/stderr capture
|
-- Test stdout/stderr capture
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles large inputs/outputs", function()
|
it('handles large inputs/outputs', function()
|
||||||
-- Test large data handling
|
-- Test large data handling
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("test case execution", function()
|
describe('test case execution', function()
|
||||||
it("runs single test case", function()
|
it('runs single test case', function()
|
||||||
-- Test individual test case execution
|
-- Test individual test case execution
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("runs multiple test cases", function()
|
it('runs multiple test cases', function()
|
||||||
-- Test batch execution
|
-- Test batch execution
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("compares outputs correctly", function()
|
it('compares outputs correctly', function()
|
||||||
-- Test output comparison logic
|
-- Test output comparison logic
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles edge cases in output comparison", function()
|
it('handles edge cases in output comparison', function()
|
||||||
-- Test whitespace, newlines, etc.
|
-- Test whitespace, newlines, etc.
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("platform-specific execution", function()
|
describe('platform-specific execution', function()
|
||||||
it("works on Linux", function()
|
it('works on Linux', function()
|
||||||
-- Test Linux-specific behavior
|
-- Test Linux-specific behavior
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("works on macOS", function()
|
it('works on macOS', function()
|
||||||
-- Test macOS-specific behavior
|
-- Test macOS-specific behavior
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("works on Windows", function()
|
it('works on Windows', function()
|
||||||
-- Test Windows-specific behavior
|
-- Test Windows-specific behavior
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,54 +1,54 @@
|
||||||
-- Unit tests for health check functionality
|
-- Unit tests for health check functionality
|
||||||
describe("cp.health", function()
|
describe('cp.health', function()
|
||||||
local health
|
local health
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
health = require("cp.health")
|
health = require('cp.health')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("system checks", function()
|
describe('system checks', function()
|
||||||
it("detects Neovim version correctly", function()
|
it('detects Neovim version correctly', function()
|
||||||
-- Test Neovim version detection
|
-- Test Neovim version detection
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("detects available compilers", function()
|
it('detects available compilers', function()
|
||||||
-- Test C++, Rust, etc. compiler detection
|
-- Test C++, Rust, etc. compiler detection
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("detects Python installation", function()
|
it('detects Python installation', function()
|
||||||
-- Test Python availability
|
-- Test Python availability
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("checks for required external tools", function()
|
it('checks for required external tools', function()
|
||||||
-- Test curl, wget, etc. availability
|
-- Test curl, wget, etc. availability
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("configuration validation", function()
|
describe('configuration validation', function()
|
||||||
it("validates contest configurations", function()
|
it('validates contest configurations', function()
|
||||||
-- Test config validation
|
-- Test config validation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("checks directory permissions", function()
|
it('checks directory permissions', function()
|
||||||
-- Test write permissions for directories
|
-- Test write permissions for directories
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("validates language configurations", function()
|
it('validates language configurations', function()
|
||||||
-- Test language setup validation
|
-- Test language setup validation
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("health report generation", function()
|
describe('health report generation', function()
|
||||||
it("generates comprehensive health report", function()
|
it('generates comprehensive health report', function()
|
||||||
-- Test :checkhealth cp output
|
-- Test :checkhealth cp output
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("provides actionable recommendations", function()
|
it('provides actionable recommendations', function()
|
||||||
-- Test that health check gives useful advice
|
-- Test that health check gives useful advice
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles partial functionality gracefully", function()
|
it('handles partial functionality gracefully', function()
|
||||||
-- Test when some features are unavailable
|
-- Test when some features are unavailable
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
-- Integration tests for complete workflows
|
-- Integration tests for complete workflows
|
||||||
describe("cp.nvim integration", function()
|
describe('cp.nvim integration', function()
|
||||||
local cp
|
local cp
|
||||||
local temp_dir
|
local temp_dir
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
cp = require("cp")
|
cp = require('cp')
|
||||||
temp_dir = vim.fn.tempname()
|
temp_dir = vim.fn.tempname()
|
||||||
vim.fn.mkdir(temp_dir, "p")
|
vim.fn.mkdir(temp_dir, 'p')
|
||||||
vim.api.nvim_set_current_dir(temp_dir)
|
vim.api.nvim_set_current_dir(temp_dir)
|
||||||
|
|
||||||
-- Set up with minimal config
|
-- Set up with minimal config
|
||||||
|
|
@ -15,22 +15,22 @@ describe("cp.nvim integration", function()
|
||||||
contests = {
|
contests = {
|
||||||
codeforces = {
|
codeforces = {
|
||||||
dir = temp_dir,
|
dir = temp_dir,
|
||||||
url = "mock://codeforces.com",
|
url = 'mock://codeforces.com',
|
||||||
languages = {
|
languages = {
|
||||||
cpp = { extension = "cpp", compile = "g++ -o %s %s" }
|
cpp = { extension = 'cpp', compile = 'g++ -o %s %s' },
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
vim.fn.delete(temp_dir, "rf")
|
vim.fn.delete(temp_dir, 'rf')
|
||||||
vim.cmd("silent! %bwipeout!")
|
vim.cmd('silent! %bwipeout!')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("complete problem setup workflow", function()
|
describe('complete problem setup workflow', function()
|
||||||
it("handles :CP codeforces 1800 A workflow", function()
|
it('handles :CP codeforces 1800 A workflow', function()
|
||||||
-- Test complete setup from command to file creation
|
-- Test complete setup from command to file creation
|
||||||
-- 1. Parse command
|
-- 1. Parse command
|
||||||
-- 2. Set up directory structure
|
-- 2. Set up directory structure
|
||||||
|
|
@ -39,28 +39,28 @@ describe("cp.nvim integration", function()
|
||||||
-- 5. Switch to buffer
|
-- 5. Switch to buffer
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles CSES workflow", function()
|
it('handles CSES workflow', function()
|
||||||
-- Test CSES-specific complete workflow
|
-- Test CSES-specific complete workflow
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles language switching", function()
|
it('handles language switching', function()
|
||||||
-- Test switching languages for same problem
|
-- Test switching languages for same problem
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("problem navigation workflow", function()
|
describe('problem navigation workflow', function()
|
||||||
it("navigates between problems in contest", function()
|
it('navigates between problems in contest', function()
|
||||||
-- Test :CP next/:CP prev workflow
|
-- Test :CP next/:CP prev workflow
|
||||||
-- Requires cached contest metadata
|
-- Requires cached contest metadata
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("maintains state across navigation", function()
|
it('maintains state across navigation', function()
|
||||||
-- Test that work isn't lost when switching problems
|
-- Test that work isn't lost when switching problems
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("test panel workflow", function()
|
describe('test panel workflow', function()
|
||||||
it("handles complete testing workflow", function()
|
it('handles complete testing workflow', function()
|
||||||
-- 1. Set up problem
|
-- 1. Set up problem
|
||||||
-- 2. Write solution
|
-- 2. Write solution
|
||||||
-- 3. Open test panel (:CP test)
|
-- 3. Open test panel (:CP test)
|
||||||
|
|
@ -69,46 +69,46 @@ describe("cp.nvim integration", function()
|
||||||
-- 6. Close panel
|
-- 6. Close panel
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles debug workflow", function()
|
it('handles debug workflow', function()
|
||||||
-- Test :CP test --debug workflow
|
-- Test :CP test --debug workflow
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("file system integration", function()
|
describe('file system integration', function()
|
||||||
it("maintains proper directory structure", function()
|
it('maintains proper directory structure', function()
|
||||||
-- Test that files are organized correctly
|
-- Test that files are organized correctly
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles existing files appropriately", function()
|
it('handles existing files appropriately', function()
|
||||||
-- Test behavior when problem already exists
|
-- Test behavior when problem already exists
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("cleans up temporary files", function()
|
it('cleans up temporary files', function()
|
||||||
-- Test cleanup of build artifacts
|
-- Test cleanup of build artifacts
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("error recovery", function()
|
describe('error recovery', function()
|
||||||
it("recovers from network failures gracefully", function()
|
it('recovers from network failures gracefully', function()
|
||||||
-- Test behavior when scraping fails
|
-- Test behavior when scraping fails
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("recovers from compilation failures", function()
|
it('recovers from compilation failures', function()
|
||||||
-- Test error handling in compilation
|
-- Test error handling in compilation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles corrupted cache gracefully", function()
|
it('handles corrupted cache gracefully', function()
|
||||||
-- Test cache corruption recovery
|
-- Test cache corruption recovery
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("multi-session behavior", function()
|
describe('multi-session behavior', function()
|
||||||
it("persists state across Neovim restarts", function()
|
it('persists state across Neovim restarts', function()
|
||||||
-- Test that contest/problem state persists
|
-- Test that contest/problem state persists
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles concurrent usage", function()
|
it('handles concurrent usage', function()
|
||||||
-- Test multiple Neovim instances
|
-- Test multiple Neovim instances
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,81 +1,81 @@
|
||||||
-- Unit tests for problem context and file management
|
-- Unit tests for problem context and file management
|
||||||
describe("cp.problem", function()
|
describe('cp.problem', function()
|
||||||
local problem
|
local problem
|
||||||
local temp_dir
|
local temp_dir
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
problem = require("cp.problem")
|
problem = require('cp.problem')
|
||||||
temp_dir = vim.fn.tempname()
|
temp_dir = vim.fn.tempname()
|
||||||
vim.fn.mkdir(temp_dir, "p")
|
vim.fn.mkdir(temp_dir, 'p')
|
||||||
-- Change to temp directory for testing
|
-- Change to temp directory for testing
|
||||||
vim.api.nvim_set_current_dir(temp_dir)
|
vim.api.nvim_set_current_dir(temp_dir)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
vim.fn.delete(temp_dir, "rf")
|
vim.fn.delete(temp_dir, 'rf')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("context creation", function()
|
describe('context creation', function()
|
||||||
it("creates context for Codeforces problems", function()
|
it('creates context for Codeforces problems', function()
|
||||||
-- Test context creation with proper paths
|
-- Test context creation with proper paths
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("creates context for CSES problems", function()
|
it('creates context for CSES problems', function()
|
||||||
-- Test CSES-specific context
|
-- Test CSES-specific context
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("generates correct file paths", function()
|
it('generates correct file paths', function()
|
||||||
-- Test source file path generation
|
-- Test source file path generation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("generates correct build paths", function()
|
it('generates correct build paths', function()
|
||||||
-- Test build directory structure
|
-- Test build directory structure
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("template handling", function()
|
describe('template handling', function()
|
||||||
it("applies language templates correctly", function()
|
it('applies language templates correctly', function()
|
||||||
-- Test template application
|
-- Test template application
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles custom templates", function()
|
it('handles custom templates', function()
|
||||||
-- Test user-defined templates
|
-- Test user-defined templates
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("supports snippet integration", function()
|
it('supports snippet integration', function()
|
||||||
-- Test LuaSnip integration
|
-- Test LuaSnip integration
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("file operations", function()
|
describe('file operations', function()
|
||||||
it("creates directory structure", function()
|
it('creates directory structure', function()
|
||||||
-- Test directory creation (build/, io/)
|
-- Test directory creation (build/, io/)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles existing files gracefully", function()
|
it('handles existing files gracefully', function()
|
||||||
-- Test behavior when files exist
|
-- Test behavior when files exist
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("sets up input/output files", function()
|
it('sets up input/output files', function()
|
||||||
-- Test I/O file creation
|
-- Test I/O file creation
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("language support", function()
|
describe('language support', function()
|
||||||
it("supports C++ compilation", function()
|
it('supports C++ compilation', function()
|
||||||
-- Test C++ setup and compilation
|
-- Test C++ setup and compilation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("supports Python execution", function()
|
it('supports Python execution', function()
|
||||||
-- Test Python setup
|
-- Test Python setup
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("supports Rust compilation", function()
|
it('supports Rust compilation', function()
|
||||||
-- Test Rust setup
|
-- Test Rust setup
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("supports custom language configurations", function()
|
it('supports custom language configurations', function()
|
||||||
-- Test user-defined language support
|
-- Test user-defined language support
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
-- Unit tests for web scraping functionality
|
-- Unit tests for web scraping functionality
|
||||||
describe("cp.scrape", function()
|
describe('cp.scrape', function()
|
||||||
local scrape
|
local scrape
|
||||||
local mock_responses = {}
|
local mock_responses = {}
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
scrape = require("cp.scrape")
|
scrape = require('cp.scrape')
|
||||||
|
|
||||||
-- Mock HTTP responses for different platforms
|
-- Mock HTTP responses for different platforms
|
||||||
mock_responses.codeforces_contest = [[
|
mock_responses.codeforces_contest = [[
|
||||||
|
|
@ -20,67 +20,67 @@ describe("cp.scrape", function()
|
||||||
]]
|
]]
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("contest metadata scraping", function()
|
describe('contest metadata scraping', function()
|
||||||
it("scrapes Codeforces contest problems", function()
|
it('scrapes Codeforces contest problems', function()
|
||||||
-- Mock HTTP request, test problem list extraction
|
-- Mock HTTP request, test problem list extraction
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("scrapes Atcoder contest problems", function()
|
it('scrapes Atcoder contest problems', function()
|
||||||
-- Test Atcoder format
|
-- Test Atcoder format
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("scrapes CSES problem list", function()
|
it('scrapes CSES problem list', function()
|
||||||
-- Test CSES format
|
-- Test CSES format
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles network errors gracefully", function()
|
it('handles network errors gracefully', function()
|
||||||
-- Test error handling for failed requests
|
-- Test error handling for failed requests
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles parsing errors gracefully", function()
|
it('handles parsing errors gracefully', function()
|
||||||
-- Test error handling for malformed HTML
|
-- Test error handling for malformed HTML
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("problem scraping", function()
|
describe('problem scraping', function()
|
||||||
it("extracts test cases from Codeforces problems", function()
|
it('extracts test cases from Codeforces problems', function()
|
||||||
-- Test test case extraction
|
-- Test test case extraction
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles multiple test cases correctly", function()
|
it('handles multiple test cases correctly', function()
|
||||||
-- Test multiple sample inputs/outputs
|
-- Test multiple sample inputs/outputs
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles problems with no sample cases", function()
|
it('handles problems with no sample cases', function()
|
||||||
-- Test edge case handling
|
-- Test edge case handling
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("extracts problem metadata (time limits, etc.)", function()
|
it('extracts problem metadata (time limits, etc.)', function()
|
||||||
-- Test metadata extraction
|
-- Test metadata extraction
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("platform-specific parsing", function()
|
describe('platform-specific parsing', function()
|
||||||
it("handles Codeforces HTML structure", function()
|
it('handles Codeforces HTML structure', function()
|
||||||
-- Test Codeforces-specific parsing
|
-- Test Codeforces-specific parsing
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles Atcoder HTML structure", function()
|
it('handles Atcoder HTML structure', function()
|
||||||
-- Test Atcoder-specific parsing
|
-- Test Atcoder-specific parsing
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles CSES HTML structure", function()
|
it('handles CSES HTML structure', function()
|
||||||
-- Test CSES-specific parsing
|
-- Test CSES-specific parsing
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("rate limiting and caching", function()
|
describe('rate limiting and caching', function()
|
||||||
it("respects rate limits", function()
|
it('respects rate limits', function()
|
||||||
-- Test rate limiting behavior
|
-- Test rate limiting behavior
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("uses cached results when appropriate", function()
|
it('uses cached results when appropriate', function()
|
||||||
-- Test caching integration
|
-- Test caching integration
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,68 +1,68 @@
|
||||||
-- Unit tests for snippet/template functionality
|
-- Unit tests for snippet/template functionality
|
||||||
describe("cp.snippets", function()
|
describe('cp.snippets', function()
|
||||||
local snippets
|
local snippets
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
snippets = require("cp.snippets")
|
snippets = require('cp.snippets')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("template loading", function()
|
describe('template loading', function()
|
||||||
it("loads default templates correctly", function()
|
it('loads default templates correctly', function()
|
||||||
-- Test default template loading
|
-- Test default template loading
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("loads platform-specific templates", function()
|
it('loads platform-specific templates', function()
|
||||||
-- Test Codeforces vs CSES templates
|
-- Test Codeforces vs CSES templates
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("loads language-specific templates", function()
|
it('loads language-specific templates', function()
|
||||||
-- Test C++ vs Python vs Rust templates
|
-- Test C++ vs Python vs Rust templates
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles custom user templates", function()
|
it('handles custom user templates', function()
|
||||||
-- Test user-defined template integration
|
-- Test user-defined template integration
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("LuaSnip integration", function()
|
describe('LuaSnip integration', function()
|
||||||
it("registers snippets with LuaSnip", function()
|
it('registers snippets with LuaSnip', function()
|
||||||
-- Test snippet registration
|
-- Test snippet registration
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("provides platform-language combinations", function()
|
it('provides platform-language combinations', function()
|
||||||
-- Test snippet triggers like cp.nvim/codeforces.cpp
|
-- Test snippet triggers like cp.nvim/codeforces.cpp
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles missing LuaSnip gracefully", function()
|
it('handles missing LuaSnip gracefully', function()
|
||||||
-- Test fallback when LuaSnip not available
|
-- Test fallback when LuaSnip not available
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("template expansion", function()
|
describe('template expansion', function()
|
||||||
it("expands templates with correct content", function()
|
it('expands templates with correct content', function()
|
||||||
-- Test template content expansion
|
-- Test template content expansion
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles template variables", function()
|
it('handles template variables', function()
|
||||||
-- Test variable substitution in templates
|
-- Test variable substitution in templates
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("maintains cursor positioning", function()
|
it('maintains cursor positioning', function()
|
||||||
-- Test cursor placement after expansion
|
-- Test cursor placement after expansion
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("template management", function()
|
describe('template management', function()
|
||||||
it("allows template customization", function()
|
it('allows template customization', function()
|
||||||
-- Test user template override
|
-- Test user template override
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("supports template inheritance", function()
|
it('supports template inheritance', function()
|
||||||
-- Test template extending/modification
|
-- Test template extending/modification
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("validates template syntax", function()
|
it('validates template syntax', function()
|
||||||
-- Test template validation
|
-- Test template validation
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,106 +1,106 @@
|
||||||
-- UI/buffer tests for the interactive test panel
|
-- UI/buffer tests for the interactive test panel
|
||||||
describe("cp test panel", function()
|
describe('cp test panel', function()
|
||||||
local cp
|
local cp
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
cp = require("cp")
|
cp = require('cp')
|
||||||
cp.setup()
|
cp.setup()
|
||||||
-- Set up a clean Neovim environment
|
-- Set up a clean Neovim environment
|
||||||
vim.cmd("silent! %bwipeout!")
|
vim.cmd('silent! %bwipeout!')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
-- Clean up test panel state
|
-- Clean up test panel state
|
||||||
vim.cmd("silent! %bwipeout!")
|
vim.cmd('silent! %bwipeout!')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("panel creation", function()
|
describe('panel creation', function()
|
||||||
it("creates test panel buffers", function()
|
it('creates test panel buffers', function()
|
||||||
-- Test buffer creation for tab, expected, actual views
|
-- Test buffer creation for tab, expected, actual views
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("sets up correct window layout", function()
|
it('sets up correct window layout', function()
|
||||||
-- Test 3-pane layout creation
|
-- Test 3-pane layout creation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("applies correct buffer settings", function()
|
it('applies correct buffer settings', function()
|
||||||
-- Test buffer options (buftype, filetype, etc.)
|
-- Test buffer options (buftype, filetype, etc.)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("sets up keymaps correctly", function()
|
it('sets up keymaps correctly', function()
|
||||||
-- Test navigation keymaps (Ctrl+N, Ctrl+P, q)
|
-- Test navigation keymaps (Ctrl+N, Ctrl+P, q)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("test case display", function()
|
describe('test case display', function()
|
||||||
it("renders test case tabs correctly", function()
|
it('renders test case tabs correctly', function()
|
||||||
-- Test tab line rendering with status indicators
|
-- Test tab line rendering with status indicators
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("displays input correctly", function()
|
it('displays input correctly', function()
|
||||||
-- Test input pane content
|
-- Test input pane content
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("displays expected output correctly", function()
|
it('displays expected output correctly', function()
|
||||||
-- Test expected output pane
|
-- Test expected output pane
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("displays actual output correctly", function()
|
it('displays actual output correctly', function()
|
||||||
-- Test actual output pane
|
-- Test actual output pane
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("shows diff when test fails", function()
|
it('shows diff when test fails', function()
|
||||||
-- Test diff mode activation
|
-- Test diff mode activation
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("navigation", function()
|
describe('navigation', function()
|
||||||
it("navigates to next test case", function()
|
it('navigates to next test case', function()
|
||||||
-- Test Ctrl+N navigation
|
-- Test Ctrl+N navigation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("navigates to previous test case", function()
|
it('navigates to previous test case', function()
|
||||||
-- Test Ctrl+P navigation
|
-- Test Ctrl+P navigation
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("wraps around at boundaries", function()
|
it('wraps around at boundaries', function()
|
||||||
-- Test navigation wrapping
|
-- Test navigation wrapping
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("updates display on navigation", function()
|
it('updates display on navigation', function()
|
||||||
-- Test content updates when switching tests
|
-- Test content updates when switching tests
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("test execution integration", function()
|
describe('test execution integration', function()
|
||||||
it("compiles and runs tests automatically", function()
|
it('compiles and runs tests automatically', function()
|
||||||
-- Test automatic compilation and execution
|
-- Test automatic compilation and execution
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("updates results in real-time", function()
|
it('updates results in real-time', function()
|
||||||
-- Test live result updates
|
-- Test live result updates
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles compilation failures", function()
|
it('handles compilation failures', function()
|
||||||
-- Test error display when compilation fails
|
-- Test error display when compilation fails
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("shows execution time", function()
|
it('shows execution time', function()
|
||||||
-- Test timing display
|
-- Test timing display
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("session management", function()
|
describe('session management', function()
|
||||||
it("saves and restores session correctly", function()
|
it('saves and restores session correctly', function()
|
||||||
-- Test session save/restore when opening/closing panel
|
-- Test session save/restore when opening/closing panel
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("handles multiple panels gracefully", function()
|
it('handles multiple panels gracefully', function()
|
||||||
-- Test behavior with multiple test panels
|
-- Test behavior with multiple test panels
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("cleans up resources on close", function()
|
it('cleans up resources on close', function()
|
||||||
-- Test proper cleanup when closing panel
|
-- Test proper cleanup when closing panel
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue