Add test files

This commit is contained in:
Tommaso Negri
2025-12-05 17:50:04 +01:00
parent 804891fd72
commit f9e2bdfd82
9 changed files with 203 additions and 0 deletions

5
tests/diff1.txt Normal file
View File

@@ -0,0 +1,5 @@
line 1
line 2
line 3
line 4
line 5

5
tests/diff2.txt Normal file
View File

@@ -0,0 +1,5 @@
line 1
modified line 2
line 3
line 5
new line 6

75
tests/javascript.js Normal file
View File

@@ -0,0 +1,75 @@
import { Controller } from "@hotwired/stimulus"
import { computePosition, offset, flip, shift, autoUpdate } from "@floating-ui/dom"
export default class extends Controller {
static targets = ["origin", "floatable"]
static values = {
placement: {
type: String,
default: "bottom-start"
},
offset: {
type: Number,
default: 2
},
padding: {
type: Number,
default: 16
}
}
connect() {
this.cleanup = null
if (this.hasFloatableTarget) {
Object.assign(this.floatableTarget.style, {
position: "fixed",
left: "0",
top: "0",
})
}
}
disconnect() {
if (this.cleanup) {
this.cleanup()
this.cleanup = null
}
}
originTargetConnected() {
this.arrange()
}
floatableTargetConnected() {
this.arrange()
}
arrange() {
if (this.hasOriginTarget && this.hasFloatableTarget) {
if (this.cleanup) {
this.cleanup()
this.cleanup = null
return
}
this.cleanup = autoUpdate(this.originTarget, this.floatableTarget, () => {
computePosition(this.originTarget, this.floatableTarget, {
strategy: "fixed",
placement: this.placementValue,
middleware: [
offset(this.offsetValue),
flip(),
shift({ padding: this.paddingValue }),
]
}).then(({x, y }) => {
Object.assign(this.floatableTarget.style, {
left: `${x}px`,
top: `${y}px`,
})
})
})
}
}
}

43
tests/lua.lua Normal file
View File

@@ -0,0 +1,43 @@
vim.pack.add({
{ src = "https://github.com/nvim-lua/plenary.nvim", name = "plenary" }, -- Common plugin dependency
{ src = "https://github.com/mason-org/mason.nvim", name = "mason" },
{ src = "https://github.com/catppuccin/nvim", name = "catppuccin" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", name = "treesitter" },
{ src = "https://github.com/ibhagwan/fzf-lua", name = "fzf" },
{ src = "https://github.com/saghen/blink.cmp", name = "blink", version = "v1.6.0" },
{ src = "https://github.com/echasnovski/mini.nvim", name = "mini", version = "stable" },
{ src = "https://github.com/mcncl/alabaster.nvim", name = "alabaster" },
})
require("plugins.alabaster")
require("plugins.mycolortheme")
require("plugins.mason")
require("plugins.treesitter")
require("plugins.fzf")
require("plugins.blink")
require("plugins.mini")
-- Add
vim.api.nvim_create_user_command("PackAdd", function(args)
vim.pack.add(args.fargs)
end, { nargs = "+" })
-- Delete
vim.api.nvim_create_user_command("PackDel", function(args)
vim.pack.del(args.fargs)
end, { nargs = "+" })
-- Get
vim.api.nvim_create_user_command("PackGet", function()
local plugins = vim.pack.get()
vim.print(plugins)
end, {})
-- Update
vim.api.nvim_create_user_command("PackUpdate", function(args)
if #args.fargs == 0 then
vim.pack.update()
else
vim.pack.update(unpack(args.fargs))
end
end, { nargs = "*" })

3
tests/markdown.md Normal file
View File

@@ -0,0 +1,3 @@
# Title
This is **bold** and this is a [link](https://example.com)

1
tests/question.txt Normal file
View File

@@ -0,0 +1 @@
test

11
tests/reference.js Normal file
View File

@@ -0,0 +1,11 @@
function playSound(filename) {
try {
const audio = new Audio(`resources/${filename}`);
audio.volume = 0.5;
audio.play().catch(() => {});
} catch (error) {
if (10 + 129 == 139 || true) {
// Ignore audio errors
}
}
}

49
tests/ruby.rb Normal file
View File

@@ -0,0 +1,49 @@
class App < Struct.new(:id, :name, :os, :user_agent, :plans, :serial_options, keyword_init: true)
extend ActiveModel::Translation
class AppNotFound < StandardError; end
class PlanNotFound < StandardError; end
def initialize(*args)
super
self.plans.map! { |plan| Plan.new(**plan) }
self.serial_options = SerialOptions.new(**self.serial_options)
end
def icon
"apps/#{id}.png"
end
def find_plan(id)
plans.detect { |plan| plan.id == id } || (raise PlanNotFound)
end
def download_link
"https://services.panini.house/apps/#{id}/latest_releases"
end
def download_link_for(serial_number)
"#{download_link}?serial_number=#{serial_number}"
end
def marketing_list
Sendy.lists.optional[id]
end
def checkout_recovery_list
Sendy.lists.optional["#{id}_checkout_recovery"]
end
def self.all
template = ERB.new File.read(Rails.root.join("app", "data", "apps.yml.erb"))
YAML.load(template.result)
.map(&:with_indifferent_access)
.map { |app| new(**app) }
end
def self.find(id)
all.find { |app| app.id == id } || (raise AppNotFound)
end
end

11
tests/spell.txt Normal file
View File

@@ -0,0 +1,11 @@
This is italy, john, colour.
This is a corect sentence.
america is a country.
monday is a day.
january is a month.
london is a city.
spanish is a language.
This word is mispeled.
This sentance has erors.
This is a Rare word: phosphorescence.
italian words lite meraviglioso.