Skip to content

test: Replace all occurrences of toEqual with toStrictEqual #1211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/tgpu-gen/tests/outputPathCompiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const test = ({
inputPattern ?? '**/*.wgsl',
outputPattern,
)(fileName),
).toEqual(expected);
).toStrictEqual(expected);

describe('createOutputPathCompiler', () => {
it('generates an output path that is the same as output pattern when no placeholders are used', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/tgpu-wgsl-parser/tests/boolLiteral.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { parse } from '../src/index.ts';

describe('bool_literal', () => {
it('parses "true"', () => {
expect(parse('true')).toEqual({
expect(parse('true')).toStrictEqual({
type: 'bool_literal',
value: 'true',
} satisfies BoolLiteral);
});

it('parses "false"', () => {
expect(parse('false')).toEqual({
expect(parse('false')).toStrictEqual({
type: 'bool_literal',
value: 'false',
} satisfies BoolLiteral);
Expand Down
6 changes: 3 additions & 3 deletions packages/tgpu-wgsl-parser/tests/callExpression.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('call_expression', () => {
args: [],
} satisfies CallExpression;

expect(parse('perform()')).toEqual(expected);
expect(parse('perform()')).toStrictEqual(expected);
});

it('parses function call with one arg', () => {
Expand All @@ -33,7 +33,7 @@ describe('call_expression', () => {
],
} satisfies CallExpression;

expect(parse('perform(true)')).toEqual(expected);
expect(parse('perform(true)')).toStrictEqual(expected);
});

it('parses function call with two args', () => {
Expand All @@ -56,6 +56,6 @@ describe('call_expression', () => {
],
} satisfies CallExpression;

expect(parse('perform(true, 0.15)')).toEqual(expected);
expect(parse('perform(true, 0.15)')).toStrictEqual(expected);
});
});
6 changes: 3 additions & 3 deletions packages/tgpu-wgsl-parser/tests/callStatement.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('call_statement', () => {
args: [],
} satisfies CallStatement;

expect(parse('perform();')).toEqual(expected);
expect(parse('perform();')).toStrictEqual(expected);
});

it('parses function call with one arg', () => {
Expand All @@ -33,7 +33,7 @@ describe('call_statement', () => {
],
} satisfies CallStatement;

expect(parse('perform(true);')).toEqual(expected);
expect(parse('perform(true);')).toStrictEqual(expected);
});

it('parses function call with two args', () => {
Expand All @@ -56,6 +56,6 @@ describe('call_statement', () => {
],
} satisfies CallStatement;

expect(parse('perform(true, 0.15);')).toEqual(expected);
expect(parse('perform(true, 0.15);')).toStrictEqual(expected);
});
});
2 changes: 1 addition & 1 deletion packages/tgpu-wgsl-parser/tests/floatLiteral.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('float_literal', () => {

it('parses float', () => {
for (const exampleFloat of EXAMPLE_FLOAT_LITERALS) {
expect(parse(exampleFloat)).toEqual({
expect(parse(exampleFloat)).toStrictEqual({
type: 'float_literal',
value: exampleFloat,
} satisfies FloatLiteral);
Expand Down
2 changes: 1 addition & 1 deletion packages/tgpu-wgsl-parser/tests/forStatement.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { parse } from '../src/index.ts';

describe('for_statement', () => {
it('parses for loop with empty body', () => {
expect(parse('for (var i = 0; i < 10; i += 1) {}')).toEqual({
expect(parse('for (var i = 0; i < 10; i += 1) {}')).toStrictEqual({
type: 'for_statement',
attrs: [],
init: {
Expand Down
10 changes: 5 additions & 5 deletions packages/tgpu-wgsl-parser/tests/functionDecl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('function_decl', () => {
],
} satisfies TranslationUnit;

expect(parse(code)).toEqual(expected);
expect(parse(code)).toStrictEqual(expected);
});

it('parses function with one statement', () => {
Expand Down Expand Up @@ -58,7 +58,7 @@ describe('function_decl', () => {
],
} satisfies TranslationUnit;

expect(parse(code)).toEqual(expected);
expect(parse(code)).toStrictEqual(expected);
});

it('parses function with attributes', () => {
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('function_decl', () => {
],
} satisfies TranslationUnit;

expect(parse(code)).toEqual(expected);
expect(parse(code)).toStrictEqual(expected);
});

it('parses function with explicit return type', () => {
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('function_decl', () => {
],
} satisfies TranslationUnit;

expect(parse(code)).toEqual(expected);
expect(parse(code)).toStrictEqual(expected);
});

it('parses function with arguments', () => {
Expand Down Expand Up @@ -197,6 +197,6 @@ describe('function_decl', () => {
],
} satisfies TranslationUnit;

expect(parse(code)).toEqual(expected);
expect(parse(code)).toStrictEqual(expected);
});
});
12 changes: 6 additions & 6 deletions packages/tgpu-wgsl-parser/tests/intLiteral.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@ import { parse } from '../src/index.ts';

describe('int_literal', () => {
it('parses decimal unsigned ints', () => {
expect(parse('0u')).toEqual({
expect(parse('0u')).toStrictEqual({
type: 'int_literal',
value: '0u',
} satisfies IntLiteral);

expect(parse('123u')).toEqual({
expect(parse('123u')).toStrictEqual({
type: 'int_literal',
value: '123u',
} satisfies IntLiteral);
});

it('parses decimal signed ints', () => {
expect(parse('0')).toEqual({
expect(parse('0')).toStrictEqual({
type: 'int_literal',
value: '0',
} satisfies IntLiteral);

expect(parse('0i')).toEqual({
expect(parse('0i')).toStrictEqual({
type: 'int_literal',
value: '0i',
} satisfies IntLiteral);

expect(parse('123')).toEqual({
expect(parse('123')).toStrictEqual({
type: 'int_literal',
value: '123',
} satisfies IntLiteral);

expect(parse('123i')).toEqual({
expect(parse('123i')).toStrictEqual({
type: 'int_literal',
value: '123i',
} satisfies IntLiteral);
Expand Down
6 changes: 3 additions & 3 deletions packages/tgpu-wgsl-parser/tests/overrideDecl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { parse } from '../src/index.ts';

describe('override_decl', () => {
it('parses untyped, unassigned', () => {
expect(parse('override example;')).toEqual({
expect(parse('override example;')).toStrictEqual({
type: 'translation_unit',
declarations: [
{
Expand All @@ -19,7 +19,7 @@ describe('override_decl', () => {
});

it('parses typed, unassigned', () => {
expect(parse('override example: u32;')).toEqual({
expect(parse('override example: u32;')).toStrictEqual({
type: 'translation_unit',
declarations: [
{
Expand All @@ -38,7 +38,7 @@ describe('override_decl', () => {
});

it('parses typed, assigned', () => {
expect(parse('override example: u32 = 123;')).toEqual({
expect(parse('override example: u32 = 123;')).toStrictEqual({
type: 'translation_unit',
declarations: [
{
Expand Down
6 changes: 3 additions & 3 deletions packages/tgpu-wgsl-parser/tests/returnStatement.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { parse } from '../src/index.ts';

describe('return_statement', () => {
it('parses empty return', () => {
expect(parse('return;')).toEqual({
expect(parse('return;')).toStrictEqual({
type: 'return_statement',
expression: null,
} satisfies ReturnStatement);
});

it('parses return of literal', () => {
expect(parse('return 123;')).toEqual({
expect(parse('return 123;')).toStrictEqual({
type: 'return_statement',
expression: {
type: 'int_literal',
Expand All @@ -21,7 +21,7 @@ describe('return_statement', () => {
});

it('parses return of math operation', () => {
expect(parse('return 10. * 0.5;')).toEqual({
expect(parse('return 10. * 0.5;')).toStrictEqual({
type: 'return_statement',
expression: {
type: 'multiply',
Expand Down
72 changes: 37 additions & 35 deletions packages/tgpu-wgsl-parser/tests/structDecl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,46 @@ import { parse } from '../src/index.ts';

describe('struct_decl', () => {
it('parses struct with simple members', () => {
expect(parse('struct Gradient { from: vec3f, to: vec3f, };')).toEqual({
declarations: [
{
type: 'struct_decl',
ident: 'Gradient',
members: [
{
type: 'struct_member',
ident: 'from',
attrs: [],
typespec: {
type: 'template_elaborated_ident',
ident: 'vec3f',
template_list: null,
},
} satisfies StructMember,
{
type: 'struct_member',
ident: 'to',
attrs: [],
typespec: {
type: 'template_elaborated_ident',
ident: 'vec3f',
template_list: null,
},
} satisfies StructMember,
],
} satisfies StructDecl,
null,
],
type: 'translation_unit',
});
expect(parse('struct Gradient { from: vec3f, to: vec3f, };')).toStrictEqual(
{
declarations: [
{
type: 'struct_decl',
ident: 'Gradient',
members: [
{
type: 'struct_member',
ident: 'from',
attrs: [],
typespec: {
type: 'template_elaborated_ident',
ident: 'vec3f',
template_list: null,
},
} satisfies StructMember,
{
type: 'struct_member',
ident: 'to',
attrs: [],
typespec: {
type: 'template_elaborated_ident',
ident: 'vec3f',
template_list: null,
},
} satisfies StructMember,
],
} satisfies StructDecl,
null,
],
type: 'translation_unit',
},
);
});

it('parses struct with members with attributes', () => {
expect(
parse('struct Gradient { @size(32) from: vec3f, to: vec3f }'),
).toEqual({
).toStrictEqual({
declarations: [
{
type: 'struct_decl',
Expand Down Expand Up @@ -85,7 +87,7 @@ describe('struct_decl', () => {
parse(
'struct Gradient { @size(32) from: vec2<f32>, @align(32) to: vec3f }',
),
).toEqual({
).toStrictEqual({
declarations: [
{
type: 'struct_decl',
Expand Down Expand Up @@ -141,7 +143,7 @@ describe('struct_decl', () => {
parse(
'struct Gradient { from: vec3f, to: vec3f, }; struct Material { color: vec3f, gradient: Gradient, };',
),
).toEqual({
).toStrictEqual({
declarations: [
{
type: 'struct_decl',
Expand Down
4 changes: 2 additions & 2 deletions packages/tgpu-wgsl-parser/tests/valueDecl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { parse } from '../src/index.ts';

describe('value_decl', () => {
it('parses non-typed', () => {
expect(parse('const example = 123;')).toEqual({
expect(parse('const example = 123;')).toStrictEqual({
type: 'value_decl',
ident: 'example',
typespec: null,
Expand All @@ -16,7 +16,7 @@ describe('value_decl', () => {
});

it('parses typed', () => {
expect(parse('const example: i32 = 123;')).toEqual({
expect(parse('const example: i32 = 123;')).toStrictEqual({
type: 'value_decl',
ident: 'example',
typespec: {
Expand Down
Loading