Skip to content

Commit

Permalink
Add test formatting functions with "match" in the name
Browse files Browse the repository at this point in the history
  • Loading branch information
ChFlick committed Jul 8, 2020
1 parent 383c83f commit ca8f5fc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/suite/autoformatter/autoformatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ describe('the autoformatter', () => {

assert.strictEqual(formattedResult, formattedDocument.getText());
});

test('should format a function named "matches" correctly', async () => {
const formattedDocument = await vscode.workspace
.openTextDocument(__dirname + '/../../../../src/test/suite/autoformatter/functionNamedMatches.formatted.rules');
const document = await vscode.workspace
.openTextDocument(__dirname + '/../../../../src/test/suite/autoformatter/functionNamedMatches.test.rules');

const formattedResult = await getDocumentFormatted(document);

assert.strictEqual(formattedResult, formattedDocument.getText());
});
});

async function getDocumentFormatted(document: vscode.TextDocument) {
Expand Down
11 changes: 11 additions & 0 deletions src/test/suite/autoformatter/functionNamedMatches.formatted.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
service firebase.storage {
match /b/{bucket}/o {
function isSignedIn() {
return request.auth != null;
}

function isWritingImage() {
return request.resource.contentType.matches('image/.*');
}
}
}
11 changes: 11 additions & 0 deletions src/test/suite/autoformatter/functionNamedMatches.test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
service firebase.storage {
match /b/{bucket}/o {
function isSignedIn() {
return request.auth != null;
}

function isWritingImage() {
return request.resource.contentType.matches('image/.*');
}
}
}

0 comments on commit ca8f5fc

Please sign in to comment.