Skip to content

Commit

Permalink
Ensure function names are camelCase (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 authored Nov 1, 2024
1 parent ff15105 commit 4d6e3ac
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 31 deletions.
8 changes: 4 additions & 4 deletions test/serve/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Aliases, parse, tokenize } from '@jupyterlite/cockle';
import { terminalInput } from './input_setup';
import { shell_setup_empty, shell_setup_complex, shell_setup_simple } from './shell_setup';
import { shellSetupEmpty, shellSetupComplex, shellSetupSimple } from './shell_setup';

async function setup() {
const cockle = {
Aliases,
parse,
shell_setup_complex,
shell_setup_empty,
shell_setup_simple,
shellSetupComplex,
shellSetupEmpty,
shellSetupSimple,
terminalInput,
tokenize
};
Expand Down
14 changes: 7 additions & 7 deletions test/serve/shell_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ export interface IOptions {
initialFiles?: IShell.IFiles;
}

export async function shell_setup_empty(options: IOptions = {}): Promise<IShellSetup> {
return await _shell_setup_common(options, 0);
export async function shellSetupEmpty(options: IOptions = {}): Promise<IShellSetup> {
return await _shellSetupCommon(options, 0);
}

export async function shell_setup_simple(options: IOptions = {}): Promise<IShellSetup> {
return await _shell_setup_common(options, 1);
export async function shellSetupSimple(options: IOptions = {}): Promise<IShellSetup> {
return await _shellSetupCommon(options, 1);
}

export async function shell_setup_complex(options: IOptions = {}): Promise<IShellSetup> {
return await _shell_setup_common(options, 2);
export async function shellSetupComplex(options: IOptions = {}): Promise<IShellSetup> {
return await _shellSetupCommon(options, 2);
}

async function _shell_setup_common(options: IOptions, level: number): Promise<IShellSetup> {
async function _shellSetupCommon(options: IOptions, level: number): Promise<IShellSetup> {
const output = new MockTerminalOutput(false);

const initialDirectories = options.initialDirectories ?? [];
Expand Down
6 changes: 3 additions & 3 deletions test/tests/aliases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import { test } from './utils';
// Wrappers to call Aliases functions in browser context.
async function get(page: Page, text: string): Promise<any> {
return await page.evaluate(async text => {
const { shell } = await globalThis.cockle.shell_setup_empty();
const { shell } = await globalThis.cockle.shellSetupEmpty();
return shell.aliases.get(text);
}, text);
}
async function getRecursive(page: Page, text: string): Promise<any> {
return await page.evaluate(async text => {
const { shell } = await globalThis.cockle.shell_setup_empty();
const { shell } = await globalThis.cockle.shellSetupEmpty();
return shell.aliases.getRecursive(text);
}, text);
}
async function match(page: Page, text: string): Promise<any> {
return await page.evaluate(async text => {
const { shell } = await globalThis.cockle.shell_setup_empty();
const { shell } = await globalThis.cockle.shellSetupEmpty();
return shell.aliases.match(text);
}, text);
}
Expand Down
2 changes: 1 addition & 1 deletion test/tests/command/ls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.describe('ls command', () => {
k: ''
}
};
const { shell, output } = await globalThis.cockle.shell_setup_simple(options);
const { shell, output } = await globalThis.cockle.shellSetupSimple(options);
await shell.setSize(10, 50);
await shell.inputLine('ls');
const ret = [output.text];
Expand Down
2 changes: 1 addition & 1 deletion test/tests/command/stty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { test } from '../utils';
test.describe('stty command', () => {
test('should return default size', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell, output } = await globalThis.cockle.shell_setup_empty();
const { shell, output } = await globalThis.cockle.shellSetupEmpty();
await shell.inputLine('stty size');
const output0 = output.text;
output.clear();
Expand Down
2 changes: 1 addition & 1 deletion test/tests/command/touch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { test } from '../utils';
test.describe('touch command', () => {
test('should create file', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell, output } = await globalThis.cockle.shell_setup_empty();
const { shell, output } = await globalThis.cockle.shellSetupEmpty();
await shell.inputLine('ls abc');
const ret = [output.text];

Expand Down
6 changes: 3 additions & 3 deletions test/tests/history.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.describe('history', () => {
/*
test('should limit storage to max size', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell, output } = await globalThis.cockle.shell_setup_empty();
const { shell, output } = await globalThis.cockle.shellSetupEmpty();
const { history } = shell;
history.setMaxSize(5);
Expand All @@ -56,7 +56,7 @@ test.describe('history', () => {
/*
test('should clip history when reduce max size', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell, output } = await globalThis.cockle.shell_setup_empty();
const { shell, output } = await globalThis.cockle.shellSetupEmpty();
const { history } = shell;
history.setMaxSize(5);
Expand Down Expand Up @@ -89,7 +89,7 @@ test.describe('history', () => {

test('should scroll up and down', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell, output } = await globalThis.cockle.shell_setup_empty();
const { shell, output } = await globalThis.cockle.shellSetupEmpty();
await shell.inputLine('cat a');
await shell.inputLine('echo hello');
await shell.inputLine('ls');
Expand Down
4 changes: 2 additions & 2 deletions test/tests/io/file_input.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { test } from '../utils';
test.describe('FileInput', () => {
test('should read from file', async ({ page }) => {
const output = await page.evaluate(async () => {
const { fileSystem } = await globalThis.cockle.shell_setup_simple();
const { fileSystem } = await globalThis.cockle.shellSetupSimple();
const fileInput = new globalThis.cockle.FileInput(fileSystem, 'file2');
return fileInput.readAll();
});
Expand All @@ -14,7 +14,7 @@ test.describe('FileInput', () => {
test('should read from file a character at a time', async ({ page }) => {
const charCodes = await page.evaluate(async () => {
const { fileSystem } = await globalThis.cockle.shell_setup_simple();
const { fileSystem } = await globalThis.cockle.shellSetupSimple();
const fileInput = new globalThis.cockle.FileInput(fileSystem, 'file2');
const ret: number[][] = [];
for (let i = 0; i < 35; i++) {
Expand Down
12 changes: 6 additions & 6 deletions test/tests/shell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ test.describe('Shell', () => {

test('should support terminal stdin', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell, output } = await globalThis.cockle.shell_setup_empty();
const { shell, output } = await globalThis.cockle.shellSetupEmpty();
const EOT = String.fromCharCode(4);
await Promise.all([
shell.inputLine('wc'),
Expand All @@ -81,7 +81,7 @@ test.describe('Shell', () => {

test('should support terminal stdin more than once', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell, output } = await globalThis.cockle.shell_setup_empty();
const { shell, output } = await globalThis.cockle.shellSetupEmpty();
const EOT = String.fromCharCode(4);
await Promise.all([
shell.inputLine('wc'),
Expand Down Expand Up @@ -183,7 +183,7 @@ test.describe('Shell', () => {

test('should arrange in columns', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell, output } = await globalThis.cockle.shell_setup_empty();
const { shell, output } = await globalThis.cockle.shellSetupEmpty();
await shell.setSize(40, 10);
await shell.input('t');
await shell.input('\t');
Expand Down Expand Up @@ -325,7 +325,7 @@ test.describe('Shell', () => {
test.describe('setSize', () => {
test('should set envVars', async ({ page }) => {
const output = await page.evaluate(async () => {
const { output, shell } = await globalThis.cockle.shell_setup_empty();
const { output, shell } = await globalThis.cockle.shellSetupEmpty();
const ret: string[] = [];
await shell.setSize(10, 44);
await shell.inputLine('env|grep LINES;env|grep COLUMNS');
Expand Down Expand Up @@ -396,7 +396,7 @@ test.describe('Shell', () => {
test.describe('dispose', () => {
test('should set isDisposed', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell } = await globalThis.cockle.shell_setup_empty();
const { shell } = await globalThis.cockle.shellSetupEmpty();
const isDisposed0 = shell.isDisposed;
shell.dispose();
const isDisposed1 = shell.isDisposed;
Expand All @@ -408,7 +408,7 @@ test.describe('Shell', () => {

test('should emit signal', async ({ page }) => {
const output = await page.evaluate(async () => {
const { shell } = await globalThis.cockle.shell_setup_empty();
const { shell } = await globalThis.cockle.shellSetupEmpty();
let signalled = false;
shell.disposed.connect(() => {
signalled = true;
Expand Down
6 changes: 3 additions & 3 deletions test/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function shellInputsSimpleN(
): Promise<string[]> {
return await page.evaluate(
async ({ charsArray, options }) => {
const { shell, output } = await globalThis.cockle.shell_setup_simple(options);
const { shell, output } = await globalThis.cockle.shellSetupSimple(options);
const ret: string[] = [];
for (const chars of charsArray) {
for (const char of chars) {
Expand Down Expand Up @@ -51,7 +51,7 @@ export async function shellLineSimpleN(
): Promise<string[]> {
return await page.evaluate(
async ({ lines, options }) => {
const { shell, output } = await globalThis.cockle.shell_setup_simple(options);
const { shell, output } = await globalThis.cockle.shellSetupSimple(options);
const ret: string[] = [];
for (const line of lines) {
await shell.inputLine(line);
Expand All @@ -71,7 +71,7 @@ export async function shellLineComplexN(
): Promise<string[]> {
return await page.evaluate(
async ({ lines, options }) => {
const { shell, output } = await globalThis.cockle.shell_setup_complex(options);
const { shell, output } = await globalThis.cockle.shellSetupComplex(options);
const ret: string[] = [];
for (const line of lines) {
await shell.inputLine(line);
Expand Down

0 comments on commit 4d6e3ac

Please sign in to comment.