Closed Bug 1230683 Opened 9 years ago Closed 8 years ago

Cleanup test_storage_connection.js

Categories

(Toolkit :: Storage, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox45 --- affected
firefox47 --- fixed

People

(Reporter: mak, Assigned: tranj23)

Details

(Whiteboard: [good first bug][lang=js])

Attachments

(1 file, 1 obsolete file)

The test can use Assert.throws instead of plain try/catch
I replaced some try/catch statements with Assert.throws in test_storage_connection.js. Then I ran the test on my local machine and all tests passed.
Attachment #8714049 - Flags: review?(mak77)
Assignee: nobody → tranj23
Comment on attachment 8714049 [details] [diff] [review]
rev1 - Replace try/catch with Assert.throws in test_storage_connection.js

Review of attachment 8714049 [details] [diff] [review]:
-----------------------------------------------------------------

::: storage/test/unit/test_storage_connection.js
@@ +67,5 @@
>  
>  add_task(function* test_createTable_already_created() {
>    var msc = getOpenedDatabase();
>    do_check_true(msc.tableExists("test"));
> +  throws(() => msc.createTable("test", "id INTEGER PRIMARY KEY, name TEXT"), /NS_ERROR_FAILURE/);

A couple things:

1. I know it works, but for readability reasons I prefer if the "Assert." part is explicit, so Assert.throws, so that it's clear where this comes from.

2. please put the error regex on the second line aligned as
Assert.throws(() => {},
              /NS_ERROR_FAILURE/);
since we still have an 80 columns soft-barrier in the coding style

This is valid for all instances where this appears

@@ +267,5 @@
>    let stmt = createStatement("SELECT * FROM test");
>    stmt.executeAsync();
>    stmt.finalize();
>  
> +  let db = getOpenedDatabase();  

trailing spaces here
Attachment #8714049 - Flags: review?(mak77)
Ok I made changes based on the review feedback of previous patch
Attachment #8714049 - Attachment is obsolete: true
Attachment #8716383 - Flags: review?(mak77)
Comment on attachment 8716383 [details] [diff] [review]
rev2 - Replace try/catch with Assert.throws in test_storage_connection.js

Review of attachment 8716383 [details] [diff] [review]:
-----------------------------------------------------------------

thanks you, it looks good to me, I'll push to the TryServer.
Attachment #8716383 - Flags: review?(mak77) → review+
https://hg.mozilla.org/mozilla-central/rev/4aaaefe703ae
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: