Skip to content

Commit 00a0b5d

Browse files
authored
Add xeus-lua kernel to conformance tests (#38)
Sixth of 7 xeus kernels requested in #30. Adds Lua language snippets.
1 parent 59b983a commit 00a0b5d

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

.github/workflows/conformance.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ jobs:
8282
- name: xeus-r
8383
install: micromamba install -y xeus-r -c conda-forge
8484
kernel-name: xr
85+
- name: xeus-lua
86+
install: micromamba install -y xeus-lua -c conda-forge
87+
kernel-name: xlua
8588

8689
steps:
8790
- uses: actions/checkout@v4
@@ -121,7 +124,7 @@ jobs:
121124
go-version: '1.22'
122125

123126
- name: Set up Mamba
124-
if: contains(fromJson('["xeus-cling", "xeus-sql", "xeus-python", "xeus-cpp", "xeus-sqlite", "xeus-r"]'), matrix.kernel.name)
127+
if: contains(fromJson('["xeus-cling", "xeus-sql", "xeus-python", "xeus-cpp", "xeus-sqlite", "xeus-r", "xeus-lua"]'), matrix.kernel.name)
125128
uses: mamba-org/setup-micromamba@v2
126129
with:
127130
micromamba-version: 'latest'
@@ -160,7 +163,7 @@ jobs:
160163
run: ${{ matrix.kernel.install }}
161164

162165
- name: Copy conda kernelspecs to user directory
163-
if: contains(fromJson('["xeus-cling", "xeus-sql", "xeus-python", "xeus-cpp", "xeus-sqlite", "xeus-r"]'), matrix.kernel.name)
166+
if: contains(fromJson('["xeus-cling", "xeus-sql", "xeus-python", "xeus-cpp", "xeus-sqlite", "xeus-r", "xeus-lua"]'), matrix.kernel.name)
164167
run: |
165168
echo "Looking for kernelspecs..."
166169
find $MAMBA_ROOT_PREFIX -name "kernel.json" 2>/dev/null || true

src/snippets.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ impl LanguageSnippets {
5252
"scala" => Self::scala(),
5353
"c++" | "cpp" => Self::cpp(),
5454
"sql" => Self::sql(),
55+
"lua" => Self::lua(),
5556
_ => Self::generic(&lang),
5657
}
5758
}
@@ -270,6 +271,27 @@ xcpp::display(h);"#,
270271
}
271272
}
272273

274+
fn lua() -> Self {
275+
// Lua scripting language
276+
Self {
277+
language: "lua".to_string(),
278+
print_hello: "print('hello')",
279+
print_stderr: "io.stderr:write('error\\n')",
280+
simple_expr: "return 1 + 1",
281+
simple_expr_result: "2",
282+
incomplete_code: "function foo(",
283+
complete_code: "x = 1",
284+
syntax_error: "function function",
285+
input_prompt: "-- Lua stdin varies by kernel",
286+
sleep_code: "-- Lua sleep requires os.execute or socket",
287+
completion_var: "test_variable_for_completion",
288+
completion_setup: "test_variable_for_completion = 42",
289+
completion_prefix: "test_variable_for_",
290+
display_data_code: "print('no rich display')",
291+
update_display_data_code: "-- Lua doesn't support update_display_data",
292+
}
293+
}
294+
273295
/// Generic fallback for unknown languages
274296
fn generic(language: &str) -> Self {
275297
Self {

0 commit comments

Comments
 (0)