Skip to content

Commit

Permalink
chore: husky access level
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinaldy Rafli committed Aug 19, 2021
1 parent 5e88cba commit 3118e2d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 31 deletions.
Empty file modified .husky/pre-commit
100644 → 100755
Empty file.
8 changes: 6 additions & 2 deletions src/languages/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export const CS: LanguagePattern[] = [
// Functions
{ pattern: /(public|private|protected|internal)\s/, points: 1 },
// Variable declaration
{ pattern: /(const\s)?(sbyte|byte|short|ushort|int|uint|long|ulong|float|double|decimal|bool|char|string)(\[\])?\s(.*)\s=\s/, points: 1},
{
pattern:
/(const\s)?(sbyte|byte|short|ushort|int|uint|long|ulong|float|double|decimal|bool|char|string)(\[\])?\s(.*)\s=\s/,
points: 1,
},
// Avoiding Java's String
{ pattern: /(String|extends|throws|@Attribute)/, points: -50 },
]
];
56 changes: 28 additions & 28 deletions tests/cs.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { test } from "uvu";
import * as assert from 'uvu/assert'
import detectLang from "../src";
import { test } from 'uvu';
import * as assert from 'uvu/assert';
import detectLang from '../src';

test('hello world', () => {
const code = detectLang(`using System;
Console.WriteLine("Hello world!");`)
assert.equal(code, 'C#')
})
Console.WriteLine("Hello world!");`);
assert.equal(code, 'C#');
});

test('fizz buzz', () => {
const code = detectLang(`class Program
Expand Down Expand Up @@ -41,14 +41,14 @@ test('fizz buzz', () => {
}
}
}
}`)
assert.equal(code, 'C#')
})
}`);
assert.equal(code, 'C#');
});

test('write file', () => {
const code = detectLang(`System.IO.File.WriteAllText("filename.txt", "This file contains a string.");`)
assert.equal(code, 'C#')
})
const code = detectLang(`System.IO.File.WriteAllText("filename.txt", "This file contains a string.");`);
assert.equal(code, 'C#');
});

test('quick sort', () => {
const code = detectLang(`//
Expand Down Expand Up @@ -226,9 +226,9 @@ test('quick sort', () => {
}
}
#endregion
}`)
assert.equal(code, 'C#')
})
}`);
assert.equal(code, 'C#');
});

test('heap sort', () => {
const code = detectLang(`using System;
Expand Down Expand Up @@ -306,9 +306,9 @@ test('heap sort', () => {
string[] s = { "-", "D", "a", "33" };
HeapSort(s, 0, s.Length, StringComparer.CurrentCultureIgnoreCase);
}
}`)
assert.equal(code, 'C#')
})
}`);
assert.equal(code, 'C#');
});

test('bubble sort', () => {
const code = detectLang(`using System;
Expand Down Expand Up @@ -354,9 +354,9 @@ test('bubble sort', () => {
foreach (var t in testList) Console.Write(t + " ");
}
}
}`)
assert.equal(code, 'C#')
})
}`);
assert.equal(code, 'C#');
});

test('merge sort', () => {
const code = detectLang(`namespace RosettaCode {
Expand Down Expand Up @@ -483,9 +483,9 @@ test('merge sort', () => {
}
}
#endregion
}`)
assert.equal(code, 'C#')
})
}`);
assert.equal(code, 'C#');
});

test('fibonacci sequence', () => {
const code = detectLang(`public static IEnumerable<long> Fibs(uint x) {
Expand All @@ -502,8 +502,8 @@ test('fibonacci sequence', () => {
}
return fibs;
}
`)
assert.equal(code, 'C#')
})
`);
assert.equal(code, 'C#');
});

test.run();
test.run();
2 changes: 1 addition & 1 deletion tests/large.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ test('large input', () => {
Rust: 4,
SQL: 0,
Unknown: 1,
'C#': 0
'C#': 0,
});
});

Expand Down

0 comments on commit 3118e2d

Please sign in to comment.