Skip to content

Commit

Permalink
adding tests, minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelangrivera committed Nov 6, 2023
1 parent 5ddb398 commit e46ab4e
Show file tree
Hide file tree
Showing 9 changed files with 741 additions and 52 deletions.
30 changes: 30 additions & 0 deletions crates/does-it-throw/src/fixtures/callExpr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @ts-nocheck
const connection = {}


const SomeThrow = () => {
throw new Error('hi khue')
}

function SomeThrow2() {
throw new Error('hi khue')
}

connection.onInitialized(() => {
if (hasConfigurationCapability) {
// Register for all configuration changes.
connection.client.register(DidChangeConfigurationNotification.type, undefined)
}
if (hasWorkspaceFolderCapability) {
connection.workspace.onDidChangeWorkspaceFolders((_event) => {
connection.console.log(`Workspace folder change event received. ${JSON.stringify(_event)}`)
})
}
SomeThrow()
SomeThrow2()
})


connection.onInitialized2(() => {
throw new Error('hi khue')
})
61 changes: 61 additions & 0 deletions crates/does-it-throw/src/fixtures/class.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// @ts-nocheck
const someCondition = true
export class Something {
constructor() {
throw new Error('hi khue')
}

someMethodThatThrows() {
throw new Error('hi khue')
}

someMethodThatDoesNotThrow() {
console.log('hi khue')
}


someMethodThatThrows2() {
if (someCondition) {
throw new Error('hi khue')
}
}

nestedThrow() {
if (someCondition) {
return true
}
throw new Error('hi khue')
}

callNestedThrow() {
if (someCondition) {
return true
}
if (someCondition) {
return true
}
this.nestedThrow()
}
}


const _somethingCall = () => {
const something = new Something()
something.someMethodThatThrows()
}

export const somethingCall = () => {
const something = new Something()
something.someMethodThatThrows()
}


function _somethingCall2 () {
const something = new Something()
something.someMethodThatThrows()
}

export function somethingCall2 () {
const something = new Something()
something.someMethodThatThrows()
}
60 changes: 60 additions & 0 deletions crates/does-it-throw/src/fixtures/class.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// @ts-nocheck
const someCondition = true
export class Something {
constructor() {
throw new Error('hi khue')
}

someMethodThatThrows({someParam}: {someParam: string}) {
throw new Error('hi khue')
}

someMethodThatDoesNotThrow() {
console.log('hi khue')
}


someMethodThatThrows2({someParam}: {someParam: string}) {
if (someParam) {
throw new Error('hi khue')
}
}

nestedThrow() {
if (someCondition) {
return true
}
throw new Error('hi khue')
}

callNestedThrow() {
if (someCondition) {
return true
}
if (someCondition) {
return true
}
this.nestedThrow()
}
}


const _somethingCall = () => {
const something = new Something()
something.someMethodThatThrows()
}

export const somethingCall = () => {
const something = new Something()
something.someMethodThatThrows()
}

function _somethingCall2 () {
const something = new Something()
something.someMethodThatThrows()
}

export function somethingCall2 () {
const something = new Something()
something.someMethodThatThrows()
}
40 changes: 40 additions & 0 deletions crates/does-it-throw/src/fixtures/exports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// @ts-nocheck

export function hiKhue() {
throw new Error('hi khue')
}

export const someConstThatThrows = () => {
throw new Error('hi khue')
}

const _ConstThatDoesNotThrow = ({}) => {
console.log('hi khue')
someCondition.hiKhue
}

const _ConstThatThrows = () => {
throw new Error('hi khue')
}

const callToConstThatThrows = () => {
someConstThatThrows()
}

export const someConstThatThrows2 = () => {
if (someCondition) {
throw new Error('hi khue')
}
}

export const callToConstThatThrows2 = () => {
someConstThatThrows2()
}

export function callToConstThatThrows3() {
someConstThatThrows2()
}

function callToConstThatThrows4() {
someConstThatThrows2()
}
53 changes: 53 additions & 0 deletions crates/does-it-throw/src/fixtures/exports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// @ts-nocheck

type SomeRandomType = {
hiKhue: string
}

export function hiKhue({ hiKhue }: { hiKhue: string }) {
throw new Error('hi khue')
}

export const someConstThatThrows = () => {
throw new Error('hi khue')
}

const _ConstThatDoesNotThrow = ({
someCondition,
}: {
someCondition: {
hiKhue: string
}
}) => {
console.log('hi khue')
someCondition.hiKhue
}

const _ConstThatThrows = () => {
throw new Error('hi khue')
}

const callToConstThatThrows = () => {
someConstThatThrows()
}

export const someConstThatThrows2 = () => {
if (someCondition) {
throw new Error('hi khue')
}
}

export const callToConstThatThrows2 = () => {
someConstThatThrows2()
}

export function callToConstThatThrows3() {
const hello: SomeRandomType = {
hiKhue: 'hi khue'
}
someConstThatThrows2()
}

function callToConstThatThrows4() {
someConstThatThrows2()
}
29 changes: 29 additions & 0 deletions crates/does-it-throw/src/fixtures/objectLiteral.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const someObjectLiteral = {
objectLiteralThrow() {
throw new Error('hi khue')
},
nestedObjectLiteral: {
nestedObjectLiteralThrow: () => {
throw new Error('hi khue')
},
},
}

export const SomeObject = {
someExampleThrow: () => {
throw new Error('hi khue')
}
}

export function callToLiteral() {
someObjectLiteral.objectLiteralThrow()
}

export const callToLiteral2 = () => {
someObjectLiteral.objectLiteralThrow()
}

export const callToLiteral3 = () => {
someObjectLiteral.nestedObjectLiteral.nestedObjectLiteralThrow()
SomeObject.someExampleThrow()
}
30 changes: 30 additions & 0 deletions crates/does-it-throw/src/fixtures/objectLiteral.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @ts-nocheck
export const someObjectLiteral = {
objectLiteralThrow({ someArg}: { someArg: string}) {
throw new Error('hi khue')
},
nestedObjectLiteral: {
nestedObjectLiteralThrow: () => {
throw new Error('hi khue')
},
},
}

export const SomeObject = {
someExampleThrow: () => {
throw new Error('hi khue')
}
}

export function callToLiteral() {
someObjectLiteral.objectLiteralThrow({ someArg: 'hi'})
}

export const callToLiteral2 = () => {
someObjectLiteral.objectLiteralThrow({ someArg: 'hi'})
}

export const callToLiteral3 = () => {
someObjectLiteral.nestedObjectLiteral.nestedObjectLiteralThrow()
SomeObject.someExampleThrow()
}
Loading

0 comments on commit e46ab4e

Please sign in to comment.